[Python-ideas] for/else statements considered harmful
andre.roberge at gmail.com
Thu Jun 7 03:02:32 CEST 2012
On Wed, Jun 6, 2012 at 9:53 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Thu, Jun 7, 2012 at 9:58 AM, Bruce Leban <bruce at leapyear.org> wrote:
> > If we could go back in time I would completely agree. But since we can't,
> > flipping meaning of else would be too error inducing and therefore not at
> > all likely.
> If anything were to change at the language level, my preference would
My preference would be for a new keyword: nobreak
This would work well with for/else and while/else which would become
for/nobreak and while/nobreak
I think that anyone reading
would (more) immediately understand that "some statements" are going to be
executed if no break occurred in the above block.
But I doubt that something like this will ever be considered even though it
could be introduced now without breaking any code (other than that which
uses "nobreak" as a variable ... which should be rare) by making it first a
duplicate of the for/else and while/else construction which would be slowly
Just my 0.02$ ...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas