RE: on writing a while loop for rolling two dice

2021-09-06 Thread Avi Gross via Python-list
For some people the "while true" method seems reasonable but it has a problem if the internal body does not have some guarantee of an exit. And that exit can be subtle. Many have mentioned ways an end condition can fail due to rounding errors not being exactly equal to what you are looking for, or

Re: Problem with python

2021-09-06 Thread Grant Edwards
On 2021-09-04, Hope Rouselle wrote: > Igor Korot writes: > >> Hi, >> Will this syntax work in python 2? > > If you say > > print(something) > > it works in both. But it doesn't always work the _same_ in both. If you're expecting some particular output, then one or the other might not won't "wo

Re: on writing a while loop for rolling two dice

2021-09-06 Thread Dennis Lee Bieber
On Sat, 4 Sep 2021 12:27:55 -0500, "Michael F. Stemper" declaimed the following: > >Kernighan and Ritchie agree(d) with you. Per _The C Programming >Language__: > Experience shows that do-while is much less used that while > and for. > And just for confusion, consider languages with

Re: on floating-point numbers

2021-09-06 Thread Dennis Lee Bieber
On Sat, 04 Sep 2021 10:40:35 -0300, Hope Rouselle declaimed the following: >course, I don't even have floats to worry about.) If I'm given 1.17, >say, I am not confident that I could turn this number into 117 by >multiplying it by 100. And that was the question. Can I always >multiply such IEE

Re: on floating-point numbers

2021-09-06 Thread Grant Edwards
On 2021-09-05, Peter J. Holzer wrote: > On 2021-09-05 03:38:55 +1200, Greg Ewing wrote: >> If 7.23 were exactly representable, you would have got >> 723/1000. >> >> Contrast this with something that *is* exactly representable: >> >> >>> 7.875.as_integer_ratio() >> (63, 8) >> >> and observe that

Re-design the position of the RPROMPT string.

2021-09-06 Thread hongy...@gmail.com
I forked and made some improvements to the ariadne package [1]. I noticed that the current RPROMPT line is composed by percol.view.PROMPT [2] and percol.view.__class__.RPROMPT [3], as shown below: X10DAi-00 (M-h/M-n)> M-m:string Path:C-d Local:C-l Unique:M-r Exit0:M-t Fold:F1,F2,F3 But

Re: on floating-point numbers

2021-09-06 Thread Hope Rouselle
"Peter J. Holzer" writes: > On 2021-09-05 03:38:55 +1200, Greg Ewing wrote: >> If 7.23 were exactly representable, you would have got >> 723/1000. >> >> Contrast this with something that *is* exactly representable: >> >> >>> 7.875.as_integer_ratio() >> (63, 8) >> >> and observe that 7875/1000

Re: CPython / Decimal and bit length of value.

2021-09-06 Thread jak
Il 03/09/2021 22:09, Nacnud Nac ha scritto: Hi, Is there a quick way to get the number of bits required to store the value in a Decimal class? What obvious thing am I missing? I'm working with really large integers, say, in the order of 5_000_000 of ASCII base 10 digits. It seems the function m

Re: on floating-point numbers

2021-09-06 Thread Hope Rouselle
Chris Angelico writes: > On Sun, Sep 5, 2021 at 1:04 PM Hope Rouselle wrote: >> The same question in other words --- what's a trivial way for the REPL >> to show me such cycles occur? >> >> >> 7.23.as_integer_ratio() >> >>> (2035064081618043, 281474976710656) >> >> Here's what I did on this

RE: on writing a while loop for rolling two dice

2021-09-06 Thread Avi Gross via Python-list
I actually like it if a language lets you spell out your intention, although adding many keywords is not a plus. So, yes something like: loop ... end loop; Is appealing as it makes clear the decision on when to exit the loop must be within the loop (or till some

RE: on writing a while loop for rolling two dice

2021-09-06 Thread Avi Gross via Python-list
Let me add something, Stefan. Some people just want to get a job done. For this person, he had a very specific need for a one-time project where the rest of it was understood but one small step was confusing. Frankly, he could have done it faster by opening a text editor on something like a CSV fil

Re: on writing a while loop for rolling two dice

2021-09-06 Thread 2QdxY4RzWzUUiLuE
On 2021-09-06 at 20:11:41 -0400, Avi Gross via Python-list wrote: > And in the python version, has anyone made a generator that returned > NULL or the like so you can say uselessly: > > for ( _ in forever() ) ... while "forever": ... -- https://mail.python.org/mailman/listinfo/pyth

RE: on writing a while loop for rolling two dice

2021-09-06 Thread Avi Gross via Python-list
I hate to quibble but as almost anything in Python can evaluate to being truthy, a command like while "never" evaluates to true as the string is not empty. I meant a generator like >>> def boring(): while True: yield() >>> for _ in boring(): print("repeating ...") The

Non sequitur: on writing a while loop for rolling two dice

2021-09-06 Thread Dennis Lee Bieber
On Mon, 6 Sep 2021 20:11:41 -0400, Avi Gross via Python-list declaimed the following: >changing. Ages ago we had code that processed MTA headers and every time we >had a meeting of standards bodies, we kept adding ever more headers and Why did my mind immediately flash on "The Man Who Ne

Non sequitur: on writing a while loop for rolling two dice

2021-09-06 Thread Dennis Lee Bieber
RESEND with clarification! On Mon, 6 Sep 2021 20:11:41 -0400, Avi Gross via Python-list declaimed the following: >changing. Ages ago we had code that processed MTA headers and every time we >had a meeting of standards bodies, we kept adding ever more headers and Why did my mind immedi

RE: on writing a while loop for rolling two dice

2021-09-06 Thread Avi Gross via Python-list
It has been nearly three decades since I have had to write in C, Stefan, but what I suggested jokingly is quite mild compared to what the winners of the obfuscated C Contest do: https://www.ioccc.org/ Time for me to drop out of this thread. Personally I fully agree uses of "while' as described ar