[Python-ideas] for/else statements considered harmful

Yuval Greenfield ubershmekel at gmail.com
Thu Jun 7 09:23:05 CEST 2012


We had quite a lengthy discussion on for/else in October 2009
http://mail.python.org/pipermail/python-ideas/2009-October/thread.html#5924

Guido mentioned:

> I would not have the feature at all if I had to do it over. I would *not*
> choose another keyword. But I don't see the same level of danger in it that
> some here see.
> I am also against adding a syntax warning for this [[loops with else but
> without break]]. It belongs in pylint etc.


http://mail.python.org/pipermail/python-ideas/2009-October/006157.html

Personally I'd prefer "if not break:" over "else:" but as we're stuck where
we are today I'm just going to encourage people not to use the construct at
all.


Yuval
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120607/9de143d1/attachment.html>


More information about the Python-ideas mailing list