Re: [Python-Dev] for...else

2017-07-29 Thread Larry Hastings
As previously requested: please take this discussion to python-ideas. If you reply, remove python-dev from the To: and Cc: lists, and add python-ideas instead. This speculative discussion was never appropriate for python-dev. //arry/ On 07/28/2017 03:11 PM, Rob Cliffe wrote: On 28/07

Re: [Python-Dev] for...else

2017-07-28 Thread Rob Cliffe
On 28/07/2017 20:57, MRAB wrote: On 2017-07-28 10:17, Michel Desmoulin wrote: elif break and elif None: I'd like that very much. It's weird a break the semantic of break and None, but it's in such a dark corner of Python anyway I don't bother. Surely it would not be "elif break", but "elif n

Re: [Python-Dev] for...else

2017-07-28 Thread MRAB
On 2017-07-28 10:17, Michel Desmoulin wrote: elif break and elif None: I'd like that very much. It's weird a break the semantic of break and None, but it's in such a dark corner of Python anyway I don't bother. Surely it would not be "elif break", but "elif not break"? Le 27/07/2017 à 21:19,

Re: [Python-Dev] for...else

2017-07-28 Thread Michel Desmoulin
elif break and elif None: I'd like that very much. It's weird a break the semantic of break and None, but it's in such a dark corner of Python anyway I don't bother. Le 27/07/2017 à 21:19, MRAB a écrit : > On 2017-07-27 03:34, Mike Miller wrote: >> >> >> On 2017-07-26 16:36, MRAB wrote: >>> "nobre

Re: [Python-Dev] for...else

2017-07-27 Thread Eric Lafontaine
funny ; this made me think of this talk; https://youtu.be/OSGv2VnC0go?t=1013 Éric Lafontaine | Membre du Projet VUE, Groupe Contrôle Génie électrique, 54ème promotion UdeS | Étudiant en maitrise TI à l'ETS VAS OPS chez Bell Mobility « Nous voulons proposer une alternative de transport en prése

Re: [Python-Dev] for...else

2017-07-27 Thread MRAB
On 2017-07-27 03:34, Mike Miller wrote: On 2017-07-26 16:36, MRAB wrote: "nobreak" would introduce a new keyword, but "not break" wouldn't. Whenever I've used the for-else, I've put a # no-break right next to it, to remind myself as much as anyone else. for...: not break: is the best altern

Re: [Python-Dev] for...else

2017-07-26 Thread Mike Miller
On 2017-07-26 16:36, MRAB wrote: "nobreak" would introduce a new keyword, but "not break" wouldn't. Whenever I've used the for-else, I've put a # no-break right next to it, to remind myself as much as anyone else. for...: not break: is the best alternative I've yet seen, congrats. Perhaps

Re: [Python-Dev] for...else

2017-07-26 Thread Terry Reedy
This discussion belongs on python-list (where is it mostly a repeat). -- Terry Jan Reedy ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-

Re: [Python-Dev] for...else

2017-07-26 Thread MRAB
On 2017-07-27 01:07, Koos Zevenhoven wrote: On Jul 27, 2017 02:38, "MRAB" > wrote: On 2017-07-26 23:55, Koos Zevenhoven wrote: ​IMO, for item in sequence: # block nobreak: # or perhaps `if not break:` #

Re: [Python-Dev] for...else

2017-07-26 Thread Koos Zevenhoven
On Jul 27, 2017 02:38, "MRAB" wrote: On 2017-07-26 23:55, Koos Zevenhoven wrote: > > ​IMO, > > for item in sequence: > # block > nobreak: # or perhaps `if not break:` > # block > > would be clearer (if the syntax is necessary at all). > You couldn't have "if not break:" because that

Re: [Python-Dev] for...else

2017-07-26 Thread MRAB
On 2017-07-26 23:55, Koos Zevenhoven wrote: On Mon, Jul 24, 2017 at 7:14 PM, Steven D'Aprano >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...

Re: [Python-Dev] for...else

2017-07-26 Thread Koos Zevenhoven
On Mon, Jul 24, 2017 at 7:14 PM, Steven D'Aprano 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

Re: [Python-Dev] for...else

2017-07-25 Thread Rob Cliffe
On 25/07/2017 06:51, Nick Coghlan wrote: On 25 July 2017 at 02:23, Ben Hoyt wrote: This is more of a python-ideas discussion, and Steven's answer is good. I'll just add one thing. Maybe it's obvious to others, but I've liked for...else since I found a kind of mnemonic to help me remember whe

Re: [Python-Dev] for...else

2017-07-24 Thread Nick Coghlan
On 25 July 2017 at 02:23, Ben Hoyt wrote: > This is more of a python-ideas discussion, and Steven's answer is good. > > I'll just add one thing. Maybe it's obvious to others, but I've liked > for...else since I found a kind of mnemonic to help me remember when the > "else" part happens: I think of

Re: [Python-Dev] for...else

2017-07-24 Thread Isaac Morland
The way I remember it is to observe that the following are *almost* exactly the same thing: if C: T else: E while C: T else: E The *only* differences are: 1) where execution jumps if it reaches the end of the T: in the "while", it jumps back to the while itself, resulting in the

Re: [Python-Dev] for...else

2017-07-24 Thread Alexander Belopolsky
On Mon, Jul 24, 2017 at 12:23 PM, Ben Hoyt wrote: > .. I found a kind of mnemonic to help me remember when the > "else" part happens: I think of it not as "for ... else" but as "break ... > else" -- saying it this way makes it clear to me that the break goes with > the else. "If this condition ins

Re: [Python-Dev] for...else

2017-07-24 Thread Ben Hoyt
This is more of a python-ideas discussion, and Steven's answer is good. I'll just add one thing. Maybe it's obvious to others, but I've liked for...else since I found a kind of mnemonic to help me remember when the "else" part happens: I think of it not as "for ... else" but as "break ... else" --

Re: [Python-Dev] for...else

2017-07-24 Thread Steven D'Aprano
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 opin

[Python-Dev] for...else

2017-07-24 Thread Kiuhnm via Python-Dev
Hello, I think that the expression "for...else" or "while...else" is completely counter-intuitive. Wouldn't it be possible to make it clearer? Maybe something like break in for i in range(n): ... if cond: break else: ... I'm not an English native speaker so