Are there any reasons not to make scalar types iterable returning the value ones? Should each function check if it has got one value or a list/tuple before iteration over the argument? What is wrong on scalars for iteration, please? There is even legal to iterate over an empty set – an empty cycle.
Python 3.8.5 (default, Jan 27 2021, 15:41:15)
def chain(*iterables):
... for iterable in iterables: ... yield from iterable ...
a = 5 b = range(3) for i in chain(a, b):
... print(i) ... Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 3, in chain TypeError: 'int' object is not iterable HG _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/UTVIGXBPAWOAPOFMN526KKSUELRXAKXC/ Code of Conduct: http://python.org/psf/codeofconduct/