[Python-ideas] for/else statements considered harmful
Andre Roberge
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.
>
> SNIP
>
> If anything were to change at the language level, my preference would
> be
SNIP
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
while ...
....
nobreak:
some statements
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
deprecated.
Just my 0.02$ ...
André
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120606/5fb4688e/attachment.html>
More information about the Python-ideas
mailing list