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 above gives me a nice infinite loop, with the second one looking like a
normal loop but actually doing nothing much.
-----Original Message-----
From: Python-list <[email protected]> On
Behalf Of [email protected]
Sent: Monday, September 6, 2021 8:28 PM
To: [email protected]
Subject: Re: on writing a while loop for rolling two dice
On 2021-09-06 at 20:11:41 -0400,
Avi Gross via Python-list <[email protected]> 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/python-list
--
https://mail.python.org/mailman/listinfo/python-list