[Python-ideas] Documenting Python warts (original) (raw)
Steven D'Aprano steve at pearwood.info
Wed Jan 2 10:27:51 CET 2013
- Previous message: [Python-ideas] Documenting Python warts
- Next message: [Python-ideas] Documenting Python warts
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 02/01/13 17:04, Mike Meyer wrote:
Oleg Broytman<phd at phdru.name> wrote: Well, some warts are quite well-known. My counter overflows when I try to count how many times anonymous code blocks have been proposed and rejected. IIRC Mr. van Rossum admitted that for/else was a design mistake. As I recall it, that wasn't because they were a bad idea per se, but because the minor upside they provide isn't worth the confusion they create for newcomers.
There would be a lot less confusion if they weren't called "else". Even now, I have to explicitly remind myself that the else block doesn't run if the for loop is empty, but after the for block.
Python 4000 proposal:
for x in seq: ... then: # this is skipped by a break else: # this runs only if seq is empty
-- Steven
- Previous message: [Python-ideas] Documenting Python warts
- Next message: [Python-ideas] Documenting Python warts
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]