replacing `else` with `then` in `for` and `try`
Alexey Muranov
alexey.muranov at gmail.com
Thu Nov 2 04:04:03 EDT 2017
On Thu, 2017-11-02 at 08:29 +1100, Chris Angelico wrote:
> > On Thu, Nov 2, 2017 at 8:23 AM, Ned Batchelder
> <ned at nedbatchelder.com
> > > wrote:
>> > >
>> > >
>> > > Apart from the questions of backward compatibility etc (Python is
>> > > unlikely
>> > > to ever go through another shift like the 2/3 breakage), are you
>> > > sure "then"
>> > > is what you mean? This won't print "end":
>> > >
>> > > for i in range(10):
>> > > print(i)
>> > > else:
>> > > print(end)
> >
> > Well, it'll bomb with NameError when it tries to look up the *name*
> > end. But it will run that line of code - if you quote it, it will
> > work.
You see how people are confused over "for ... else".
Alexey.
More information about the Python-list
mailing list