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

2021-09-11 Thread Vinay Sajip via Python-list
What Does It Do? The CFG configuration format is a text format for configuration files which is similar to, and a superset of, the JSON format.It has the following aims: * Allow a hierarchical configuration scheme with support for key-value mappings and   lists. * Support cross-

Re: on writing a while loop for rolling two dice

2021-09-11 Thread dn via Python-list
On 11/09/2021 18.03, Chris Angelico wrote: > 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 > wh

Re: on writing a while loop for rolling two dice

2021-09-11 Thread Peter J. Holzer
On 2021-09-08 13:07:47 +1200, Greg Ewing wrote: > On 8/09/21 2:53 am, Grant Edwards wrote: > >#define IF if ( > >#define THEN ) { > >#define ELSE } else { > >#define ENDIF } > > I gather that early versions of some of the Unix utilities were > written by someone who liked using mac

Re: Friday Finking: Contorted loops

2021-09-11 Thread Peter J. Holzer
On 2021-09-10 12:26:24 +0100, Alan Gauld via Python-list wrote: > 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? > O

Re: on floating-point numbers

2021-09-11 Thread Peter J. Holzer
On 2021-09-05 22:32:51 -, Grant Edwards wrote: > On 2021-09-05, Peter J. Holzer wrote: [on the representability of fractional numbers as floating point numbers] > And once you understand that, ignore it and write code under the > assumumption that nothing can be exactly represented in floati

Re: on floating-point numbers

2021-09-11 Thread Peter J. Holzer
On 2021-09-05 23:21:14 -0400, Richard Damon wrote: > > On Sep 5, 2021, at 6:22 PM, Peter J. Holzer wrote: > > On 2021-09-04 10:01:23 -0400, Richard Damon wrote: > >>> On 9/4/21 9:40 AM, Hope Rouselle wrote: > >>> Hm, I think I see what you're saying. You're saying multiplication and > >>> divisio

Re: on floating-point numbers

2021-09-11 Thread Chris Angelico
On Sun, Sep 12, 2021 at 1:07 AM Peter J. Holzer wrote: > If you have any "decimals" (i.e decimal digits to the right of your > decimal point) then the input values won't be exactly representable and > the nearest representation will use all available bits, thus losing some > precision with most ad

Re: Friday Finking: Contorted loops

2021-09-11 Thread Alan Gauld via Python-list
On 10/09/2021 19:49, Stefan Ram wrote: > 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. I'm not sure that's true. Most

Re: on writing a while loop for rolling two dice

2021-09-11 Thread Andrew Jaffe
On 11/09/2021 10:09, dn via Python-list wrote: The stated requirement is: "I'd like to get the number of times I tried". Given such: why bother with returning any of the pairs of values? Indeed, if that's the requirement, then you can do even better, noting that the probability of getting a

Re: on floating-point numbers

2021-09-11 Thread Peter J. Holzer
On 2021-09-12 01:40:12 +1000, Chris Angelico wrote: > On Sun, Sep 12, 2021 at 1:07 AM Peter J. Holzer wrote: > > If you have any "decimals" (i.e decimal digits to the right of your > > decimal point) then the input values won't be exactly representable and > > the nearest representation will use a

RE: Friday Finking: Contorted loops

2021-09-11 Thread Avi Gross via Python-list
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 apart and you end up having to dangle a part

RE: Friday Finking: Contorted loops

2021-09-11 Thread Avi Gross via Python-list
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 to just fitting your mood better? I have seen seasoned authors go back