Re: [Python-ideas] "while:" for the loop

2018-10-02 Thread Rhodri James
On 02/10/18 12:31, Jonathan Fine wrote: Mikhail V has suggested "while:" as a shorthand for "while True:". He's also provided a helpful list of URLs for related discussion. I'd like to suggest another approach. Before we hare off into the middle distance, could you show that there is a problem

Re: [Python-ideas] "while:" for the loop

2018-10-02 Thread Jonathan Fine
Mikhail V has suggested "while:" as a shorthand for "while True:". He's also provided a helpful list of URLs for related discussion. I'd like to suggest another approach. My suggestion is to improved documentation and help. For me a search for python "while True" produces as the top result ht

Re: [Python-ideas] "while:" for the loop

2018-09-28 Thread Mikhail V
I put the list of related discussion here, just in case. Same suggestion: https://mail.python.org/pipermail/python-dev/2005-July/054914.html Idea for the "loop" keyword: https://mail.python.org/pipermail/python-ideas/2014-June/028202.html (followed by the same suggestion from @Random832: https://

Re: [Python-ideas] "while:" for the loop

2018-09-27 Thread Hans Polak
On 26/09/18 18:23, Michael Selik wrote: Guido has repeatedly (haha) rejected this proposal [0]. He has written that he considered it, but decided that in practical code one almost always loops over data, and does not want an arbitrary number of iterations. The range object solves this problem.

Re: [Python-ideas] "while:" for the loop

2018-09-26 Thread Stephen J. Turnbull
Mikhail V writes: > In the first linked discussion, e.g. Mr. D'Aprano and Mr. Coghlan (from my > impression both from dev team) unambiguosly claimed that adding e.g. > "loop" as a loop token lead to necessity of excluding ALL > variables and functions/methods named "loop" from all sources. >

Re: [Python-ideas] "while:" for the loop

2018-09-26 Thread Mike Miller
On 2018-09-25 17:46, Mikhail V wrote: I suggest allowing "while:" syntax for the infinite loop. I.e. instead of "while 1:" and "while True:" notations. I like this idea, and would have use for it. -Mike ___ Python-ideas mailing list Python-ideas@p

Re: [Python-ideas] "while:" for the loop

2018-09-26 Thread Mikhail V
On Wed, Sep 26, 2018 at 4:46 PM Mark E. Haase wrote: > > On Tue, Sep 25, 2018 at 8:47 PM Mikhail V wrote: >> >> As for statistics - IIRC someone gave statistics once, but the only >> thing I can remember [...] "while 1/True" is used quite a lot in the > > This proposal would be a lot stronger if

Re: [Python-ideas] "while:" for the loop

2018-09-26 Thread Kirill Balunov
On Wed, Sep 26, 2018, 19:30 David Mertz wrote: > We also have: > > from itertools import count > for i in count(): > ... > > If you want to keep track of how close to infinity you are. :-) > We also have: from itertools import repeat for i in repeat(...): ... with kind regards, -gdg __

Re: [Python-ideas] "while:" for the loop

2018-09-26 Thread David Mertz
We also have: from itertools import count for i in count(): ... If you want to keep track of how close to infinity you are. :-) On Wed, Sep 26, 2018, 12:24 PM Michael Selik wrote: > On Wed, Sep 26, 2018, 9:42 AM Tobias Kohn wrote: > >> Although I doubt it will really make it into Python's

Re: [Python-ideas] "while:" for the loop

2018-09-26 Thread Michael Selik
On Wed, Sep 26, 2018, 9:42 AM Tobias Kohn wrote: > Although I doubt it will really make it into Python's grammar, I am all +1 > for the idea of having "repeat" as a loop keyword in Python. Actually, I > have been using "repeat" as a keyword in Python for quite some time now, > and found it not o

Re: [Python-ideas] "while:" for the loop

2018-09-26 Thread Mark E. Haase
On Tue, Sep 25, 2018 at 8:47 PM Mikhail V wrote: > As for statistics - IIRC someone gave statistics once, but the only > thing I can remember - > "while 1/True" is used quite a lot in the std lib, so the numbers > exceeded my expectation > (because I expected that it's used mostly in algorithms).

Re: [Python-ideas] "while:" for the loop

2018-09-26 Thread Tobias Kohn
Hello, Although I doubt it will really make it into Python's grammar, I am all +1 for the idea of having "repeat" as a loop keyword in Python.  Actually, I have been using "repeat" as a keyword in Python for quite some time now, and found it not only convenient, but also a great help in

Re: [Python-ideas] "while:" for the loop

2018-09-26 Thread James Lu
repeat could be only considered a keyword when it’s used as a loop Sent from my iPhone > On Sep 26, 2018, at 8:46 AM, Brice Parent wrote: > >> Le 26/09/2018 à 14:33, James Lu a écrit : >> what about “repeat:”? >> >> Sent from my iPhone > I'm not sure it was on purpose, but you replied to me on

Re: [Python-ideas] "while:" for the loop

2018-09-26 Thread Brice Parent
Le 26/09/2018 à 05:36, Chris Angelico a écrit : On Wed, Sep 26, 2018 at 1:29 PM Mikhail V wrote: On Wed, Sep 26, 2018 at 5:38 AM Chris Angelico wrote: I like saying while "something": where the string describes the loop's real condition. For instance, while "moar data": if reading from a s

Re: [Python-ideas] "while:" for the loop

2018-09-25 Thread Chris Angelico
On Wed, Sep 26, 2018 at 1:29 PM Mikhail V wrote: > > On Wed, Sep 26, 2018 at 5:38 AM Chris Angelico wrote: > > > > > > I like saying while "something": where the string describes the loop's > > real condition. For instance, while "moar data": if reading from a > > socket, or while "not KeyboardIn

Re: [Python-ideas] "while:" for the loop

2018-09-25 Thread Mikhail V
On Wed, Sep 26, 2018 at 5:38 AM Chris Angelico wrote: > > > I like saying while "something": where the string describes the loop's > real condition. For instance, while "moar data": if reading from a > socket, or while "not KeyboardInterrupt": if the loop is meant to be > halted by SIGINT. > > Chr

Re: [Python-ideas] "while:" for the loop

2018-09-25 Thread Chris Angelico
On Wed, Sep 26, 2018 at 12:35 PM Michael Selik wrote: > > On Tue, Sep 25, 2018 at 8:46 PM Mikhail V wrote: > > I suggest allowing "while:" syntax for the infinite loop. > > I.e. instead of "while 1:" and "while True:" notations. > > > > My opinion: > > 1. I think it'd definitely improve clarity

Re: [Python-ideas] "while:" for the loop

2018-09-25 Thread Michael Selik
On Tue, Sep 25, 2018 at 8:46 PM Mikhail V wrote: > I suggest allowing "while:" syntax for the infinite loop. > I.e. instead of "while 1:" and "while True:" notations. > > My opinion: > 1. I think it'd definitely improve clarity. I prefer the explicit phrase, ``while True:``. Saying "while" with

[Python-ideas] "while:" for the loop

2018-09-25 Thread Mikhail V
I suggest allowing "while:" syntax for the infinite loop. I.e. instead of "while 1:" and "while True:" notations. IIRC, in the past this was mentioned in python-list discussions as alternative for the "while True:"/"while 1:" syntax. I even had impression that there was nothing rational against