[Python-ideas] Re: while(tt--)

2023-08-21 Thread Chris Angelico
On Tue, 22 Aug 2023 at 05:34, Wes Turner wrote: > > On Sat, Aug 19, 2023, 7:27 PM Celelibi wrote: >> >> 2023-08-04 8:18 UTC+02:00, daniil.arashkev...@gmail.com >> : >> > Currently in Python we have construction like this: >> > >> > tt = 5 >> > while t: >> > # do something >> > tt -= 1 >>

[Python-ideas] Re: while(tt--)

2023-08-21 Thread Wes Turner
On Sat, Aug 19, 2023, 7:27 PM Celelibi wrote: > 2023-08-04 8:18 UTC+02:00, daniil.arashkev...@gmail.com > : > > Currently in Python we have construction like this: > > > > tt = 5 > > while t: > > # do something > > tt -= 1 > > > > It would be great if in Python we have something like

[Python-ideas] Re: while(tt--)

2023-08-19 Thread Chris Angelico
On Sun, 20 Aug 2023 at 09:28, Celelibi wrote: > Just as a reminder of C/C++: {pre,post}-{inc,dec}rementations bring > their lot of issues with the language. Mostly the infamous *undefined > behavors*. If you've done some C or C++ this very expression might > send shivers down your spine. The

[Python-ideas] Re: while(tt--)

2023-08-19 Thread Celelibi
2023-08-04 8:18 UTC+02:00, daniil.arashkev...@gmail.com : > Currently in Python we have construction like this: > > tt = 5 > while t: > # do something > tt -= 1 > > It would be great if in Python we have something like this: > tt = 5 > while (tt--): > # do something > > It is exists in

[Python-ideas] Re: while(tt--)

2023-08-11 Thread Rob Cliffe via Python-ideas
On 04/08/2023 14:02, Niktar Lirik via Python-ideas wrote: Hi Daniil. Yes, you can do almost same:     tt = 5     while tt := tt - 1:     print(tt) "almost" is right.  The OP's version, as far as I can tell, wants to do post-decrement (test tt, then decrement it) so it would "do

[Python-ideas] Re: while(tt--)

2023-08-04 Thread Niktar Lirik via Python-ideas
Hi Daniil. Yes, you can do almost same:     tt = 5     while tt := tt - 1:     print(tt) 04.08.2023 9:18, daniil.arashkev...@gmail.com пишет: Currently in Python we have construction like this: tt = 5 while t: # do something tt -= 1 It would be great if in Python we have

[Python-ideas] Re: while(tt--)

2023-08-04 Thread Simão Afonso
I'm not sure if you are trolling, but why not use "range"? Can't get more Pythonic than that. -- *Powertools Technologies, Lda* R. Alves Redol 9 * 1000-029 Lisboa * Portugal Phone: +351 214 009 555 * GPS: 38°44'10.927"N 9°8'26.757"W E-mail: cont...@powertools-tech.com *