On Fri, Apr 16, 2021 at 7:32 PM Hans Ginzel <[email protected]> wrote:
>
> On Wed, Apr 14, 2021 at 09:05:17AM -0700, Christopher Barker wrote:
> >so that one could write:
> >for i in 23:
> >   ...
>
> I am proposing this ill run the cycle ones with i=23.
>

And other people would expect it to run 23 times.

Integers are not iterable and it's far better to keep them that way.
If you need to iterate once over an integer, just surround it in
square brackets.

>>> a = [5]
>>> b = range(3)
>>> for i in chain(a, b):
...   print(i)

Job done, no need to try to pretend that everything is a set containing itself.

ChrisA
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/Q7VELTZU5UMG2ICWLXR4RVFRC2PREQIB/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to