[Python-ideas] for/else statements considered harmful

Yuval Greenfield ubershmekel at gmail.com
Thu Jun 7 10:31:22 CEST 2012

On Thu, Jun 7, 2012 at 10:57 AM, Devin Jeanpierre <jeanpierreda at gmail.com>wrote:

> On Thu, Jun 7, 2012 at 3:23 AM, Yuval Greenfield <ubershmekel at gmail.com>
> wrote:
> > 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.
> Why shouldn't people use for-else?
> -- Devin

For-else/while-else are confusing. During the previous discussion even the
construct's proponents have fallen to its misleading nature. The word
"else" alone just doesn't fit its role here no matter how intricate and
carefully constructed an example is given to explain its nature or

I believe using for/else will cause you and maintainers of your code to
make more mistakes.

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

More information about the Python-ideas mailing list