[Python-Dev] for...else (original) (raw)
Koos Zevenhoven k7hoven at gmail.com
Wed Jul 26 18:55:34 EDT 2017
- Previous message (by thread): [Python-Dev] for...else
- Next message (by thread): [Python-Dev] for...else
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Jul 24, 2017 at 7:14 PM, Steven D'Aprano <steve at pearwood.info> wrote:
Hello Kiuhnm, and welcome.
On Mon, Jul 24, 2017 at 05:35:03PM +0200, Kiuhnm via Python-Dev wrote: > Hello, > > I think that the expression "for...else" or "while...else" is completely > counter-intuitive.
You may be right -- this has been discussed many, many times before. In my personal opinion, the best (and only accurate!) phrase would have been: for item in sequence: # block then: # block IMO,
for item in sequence:
# block
nobreak: # or perhaps if not break:
# block
would be clearer (if the syntax is necessary at all).
[...]
> Wouldn't it be possible to make it clearer? Maybe > something like At this point, no, it is not practical to change the syntax used. Maybe when Python 3.0 was first introduced, but that ship has long sailed. It is very, very unlikely that the syntax for this will ever change, but if it does, it probably won't be until something in the distant future like Python 5.
I don't have a strong opinion on this particular case, but if something like this is changed in Python 5, I think the decision should be made much earlier (now?) so that the old else syntax could be discouraged (and new syntax potentially already introduced). The same thing would apply to many other "possibly in Python 5" changes, where there is no reason to expect that the situation is somehow different years later.
-- Koos
But not Python 4: Guido has already ruled that Python 4 will not include major backwards-incompatible changes. Going from 3 to 4 will not be as disruptive as going from 2 to 3. [...]
--
- Koos Zevenhoven + http://twitter.com/k7hoven + -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20170727/672e7e1c/attachment.html>
- Previous message (by thread): [Python-Dev] for...else
- Next message (by thread): [Python-Dev] for...else
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]