Re: Friday Finking: Contorted loops

2021-09-12 Thread Alan Gauld via Python-list
On 12/09/2021 09:11, jak wrote: > if the only way to terminate a 'while True' loop is by using the 'break' > statement, why is it allowed to add the 'else' statement which will only > contain dead code? > > while True: > break > else: > print('dead code') > Because to the interpreter

RE: Friday Finking: Contorted loops

2021-09-12 Thread Avi Gross via Python-list
Some of what I read makes me chuckle. Yes, large units of code, and even smaller ones, may be a chore to figure out. Arguably harder when you use indentation and the next/last parts are not even on the same screen as the rest. Sometimes you want to use a split-screen in some editor to line up the

Re: Friday Finking: Contorted loops

2021-09-12 Thread Peter J. Holzer
On 2021-09-12 10:28:22 -0700, 2qdxy4rzwzuui...@potatochowder.com wrote: > On 2021-09-11 at 18:21:17 +0100, > Alan Gauld via Python-list wrote: > > On 11/09/2021 15:41, Peter J. Holzer wrote: > > > How is C's do/while loop more horrible than Pascal's repeat/until? [...] > > so code that has > > >

Re: ANN: Version 0.5.1 of the Python config module has been released.

2021-09-12 Thread Vinay Sajip via Python-list
Many of those 4.8K "users" might be using indirectly via some other dependency - I'm not sure how GitHub calculates "used by", but even if it were a direct dependency, one has no idea if it's actually being used or not. so I tend not to worry about such things. My distlib library has only 2 star

RE: Friday Finking: Contorted loops

2021-09-12 Thread Avi Gross via Python-list
Stefan, Agreed that writing code to handle all possible eventualities is usually overkill and results in bloated software delivered very late or not at all. My point is that often OTHERS start adding requests afterward that seem trivial to THEM as they have no idea what it takes. I have often don

RE: Friday Finking: Contorted loops

2021-09-12 Thread Avi Gross via Python-list
The topic of looping and our current discussion stimulates me to ask if someone has categorized the uses of loops and it seems something obvious. Once you know what kinds of loopy looping there are, it can get easier to decide which, if any, of the methods to set up a loop make more sense. Compute

Re: Friday Finking: Contorted loops

2021-09-12 Thread 2QdxY4RzWzUUiLuE
On 2021-09-11 at 18:21:17 +0100, Alan Gauld via Python-list wrote: > On 11/09/2021 15:41, Peter J. Holzer wrote: > > > How is C's do/while loop more horrible than Pascal's repeat/until? > > Because it is very hard to spot or distinguish from a normal > while loop. > > while condition ; > > I

Re: ANN: Version 0.5.1 of the Python config module has been released.

2021-09-12 Thread Abdur-Rahmaan Janhangeer
Used by 4.8k but only ... 4 stars -- https://mail.python.org/mailman/listinfo/python-list

Re: Friday Finking: Contorted loops

2021-09-12 Thread jak
Il 11/09/2021 22:29, Avi Gross ha scritto: Alan and others, I think human languages used to make computer languages will often cause confusion. Some languages have an IF .. ELSE construct but also an EITHER ... OR and a NEITHER ... NOR and other twists and turns like words that sometimes come

Re: Friday Finking: Contorted loops

2021-09-12 Thread alister via Python-list
On Sun, 12 Sep 2021 10:11:15 +0200, jak wrote: > -- snip -- >> >> An inconsistency that I have been able to notice is this: >> someone suggests to remedy the absence of the do-while with: >> while True: >> ... >> if condition: >> break >> the problem arises if the while has

Re: Friday Finking: Contorted loops

2021-09-12 Thread Joe Pfeiffer
r...@zedat.fu-berlin.de (Stefan Ram) writes: > Alan Gauld writes: >>OK, That's a useful perspective that is at least consistent. >>Unfortunately it's not how beginners perceive it > ... > > Beginners perceive it the way it is explained to them by > their teacher. My life as a professor would

Re: Friday Finking: Contorted loops

2021-09-12 Thread jak
-- snip -- An inconsistency that I have been able to notice is this: someone suggests to remedy the absence of the do-while with: while True: ... if condition: break the problem arises if the while has an else of its own because the break not only blocks the while loop but

Re: on floating-point numbers

2021-09-12 Thread Grant Edwards
On 2021-09-11, Chris Angelico wrote: > Once you accept that "perfectly representable numbers" aren't > necessarily the ones you expect them to be, 64-bit floats become > adequate for a huge number of tasks. Even 32-bit floats are pretty > reliable for most tasks, although I suspect that there's l

Re: Friday Finking: Contorted loops

2021-09-12 Thread Alan Gauld via Python-list
On 11/09/2021 15:41, Peter J. Holzer wrote: > How is C's do/while loop more horrible than Pascal's repeat/until? Because it is very hard to spot or distinguish from a normal while loop. while condition ; Is a valid (and fairly common) loop in C so code that has do{ code } while condition; L

Re: Friday Finking: Contorted loops

2021-09-12 Thread Peter J. Holzer
On 2021-09-11 21:38:02 -0400, Avi Gross via Python-list wrote: > Peter, in your own personal finite sample, I am wondering what you might do > TODAY if you looked at your loops again and considered redoing them for an > assortment of reasons ranging from using the code for teaching to efficiency >