Re: on writing a while loop for rolling two dice

2021-09-10 Thread Chris Angelico
On Sat, Sep 11, 2021 at 3:26 PM dn via Python-list wrote: > > On 31/08/2021 01.50, Chris Angelico wrote: > > On Mon, Aug 30, 2021 at 11:13 PM David Raymond > > wrote: > >> > >>> def how_many_times(): > >>> x, y = 0, 1 > >>> c = 0 > >>> while x != y: > >>> c = c + 1 > >>> x, y = rol

Re: on writing a while loop for rolling two dice

2021-09-10 Thread dn via Python-list
On 31/08/2021 01.50, Chris Angelico wrote: > On Mon, Aug 30, 2021 at 11:13 PM David Raymond > wrote: >> >>> def how_many_times(): >>> x, y = 0, 1 >>> c = 0 >>> while x != y: >>> c = c + 1 >>> x, y = roll() >>> return c, (x, y) >> >> Since I haven't seen it used in answers yet, her

Re: Friday Finking: Contorted loops

2021-09-10 Thread Joe Pfeiffer
2qdxy4rzwzuui...@potatochowder.com writes: > On 2021-09-10 at 15:08:19 -0600, > Joe Pfeiffer wrote: > >> r...@zedat.fu-berlin.de (Stefan Ram) writes: > >> > The existence of statements like "break" renders >> > proof techniques for loops (such as Hoare's) with >> > their invariants and inf

Re: Friday Finking: Contorted loops

2021-09-10 Thread Terry Reedy
On 9/10/2021 7:38 AM, Alan Gauld via Python-list wrote: But python complicates this tenet still further by adding an else clause to its loops. And complicating this still more is that these else clauses have almost exactly opposite effects. To the contrary... if...else executes the else part

Re: Change the display style of the text on the STACKLINE.

2021-09-10 Thread hongy...@gmail.com
On Saturday, September 11, 2021 at 7:43:44 AM UTC+8, hongy...@gmail.com wrote: > On Friday, September 10, 2021 at 2:12:31 PM UTC+8, Roland Mueller wrote: > > pe 10. syysk. 2021 klo 8.53 hongy...@gmail.com (hongy...@gmail.com) > > kirjoitti: > > > On Thursday, September 9, 2021 at 8:57:37 PM UTC+

Re: Change the display style of the text on the STACKLINE.

2021-09-10 Thread hongy...@gmail.com
On Friday, September 10, 2021 at 2:12:31 PM UTC+8, Roland Mueller wrote: > pe 10. syysk. 2021 klo 8.53 hongy...@gmail.com (hongy...@gmail.com) > kirjoitti: > > On Thursday, September 9, 2021 at 8:57:37 PM UTC+8, Roland Mueller wrote: > > > Hello > > > > > > to 9. syysk. 2021 klo 6.53 hongy...@g

Re: Friday Finking: Contorted loops

2021-09-10 Thread 2QdxY4RzWzUUiLuE
On 2021-09-10 at 15:08:19 -0600, Joe Pfeiffer wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes: > > The existence of statements like "break" renders > > proof techniques for loops (such as Hoare's) with > > their invariants and inference rules unapplicable. > > Also the reason to avo

leave

2021-09-10 Thread flaskee via Python-list
Sent with [ProtonMail](https://protonmail.com/) Secure Email. -- https://mail.python.org/mailman/listinfo/python-list

RE: Friday Finking: Contorted loops

2021-09-10 Thread Avi Gross via Python-list
In this discussion, I shudder to mention that people often simply use all kinds of additional logic to get a result. How much code have you seen that has some variable like "completed = False" that can be set to True in multiple places and many areas inside the loop are enclosed in an IF stateme

RE: Friday Finking: Contorted loops

2021-09-10 Thread Avi Gross via Python-list
So why use the word "else" when it really does not mean what users consider else? Again, we have words like "finally" used in some places to mean it should be done no matter what, like closing a file that may be open. What phrase used either in one or all contexts might have been better, if longe

Re: Friday Finking: Contorted loops

2021-09-10 Thread Joe Pfeiffer
r...@zedat.fu-berlin.de (Stefan Ram) writes: > r...@zedat.fu-berlin.de (Stefan Ram) writes: >>can be misleading, because the "..." part can still contain >>"break", "raise", "continue", and "return" statement. So one >>better should always be on the watch when reading source code >>of a language l

Re: Change the display style of the text on the STACKLINE.

2021-09-10 Thread Roland Mueller via Python-list
pe 10. syysk. 2021 klo 17.22 Greg Ewing (greg.ew...@canterbury.ac.nz) kirjoitti: > On 10/09/21 6:11 pm, Roland Mueller wrote: > > When I call print(s) it even shows ABCD and D is underscored. But > copying > > the output to mail looses the underscore ... > > If the terminal understands unicode, C

Re: Friday Finking: Contorted loops

2021-09-10 Thread Alan Gauld via Python-list
On 10/09/2021 16:36, MRAB wrote: >> while...else... >> >> executes the else if the body of the loop does NOT get executed. >> >> for...else... >> >> executes the else iff ALL iterations of the for loop DO complete. >> > [snip] > > In both cases, it executes the 'else' part if it didn't break out

Re: Friday Finking: Contorted loops

2021-09-10 Thread MRAB
On 2021-09-10 12:38, Alan Gauld via Python-list wrote: On 09/09/2021 22:36, dn via Python-list wrote: Even in fairly modest Python constructs, we quickly repeal the one-in, one-out philosophy because try...except operates by providing another exit-path. Exceptions are exceptional by their nat

Re: Friday Finking: Contorted loops

2021-09-10 Thread Alan Gauld via Python-list
On 10/09/2021 00:47, Terry Reedy wrote: > even one loop is guaranteed.) "do-while" or "repeat-until is even rarer > since fractional-loop include this as a special case. Is there any empirical evidence to support this? Or is it just a case of using the tools that are available? In my experience

Re: Making command-line args available to deeply-nested functions

2021-09-10 Thread Loris Bennett
George Fischhof writes: > George Fischhof ezt írta (időpont: 2021. aug. 29., V, > 21:27): > >> >> >> Loris Bennett ezt írta (időpont: 2021. aug. >> 26., Cs, 16:02): >> >>> George Fischhof writes: >>> >>> [snip (79 lines)] >>> >>> >> > Hi, >>> >> > >>> >> > Also you can give a try to click and

Re: Change the display style of the text on the STACKLINE.

2021-09-10 Thread Greg Ewing
On 10/09/21 6:11 pm, Roland Mueller wrote: When I call print(s) it even shows ABCD and D is underscored. But copying the output to mail looses the underscore ... If the terminal understands unicode, Combining Low Line: U+0332 might help -- Greg -- https://mail.python.org/mailman/listinfo/pyth

Re: Friday Finking: Contorted loops

2021-09-10 Thread Alan Gauld via Python-list
On 09/09/2021 22:36, dn via Python-list wrote: > Even in fairly modest Python constructs, we quickly repeal the one-in, > one-out philosophy because try...except operates by providing another > exit-path. Exceptions are exceptional by their nature (or should be!) As such they can arguably be excu

Re: Friday Finking: Contorted loops

2021-09-10 Thread Greg Ewing
On 10/09/21 11:47 am, Terry Reedy wrote: 2. It is rare useful.  For loops are common.  While loops are occasional (nearly an order of magnitude less common than for loops.  Fractional loop constructs are rare. I would say that fractional loops are more common than loops which truly need to exe