[issue32259] Misleading "not iterable" Error Message when generator return a "simple" type, and a tuple is expected
Serhiy Storchaka
report at bugs.python.org
Mon Dec 18 16:40:26 EST 2017
Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
Is it worth to emit more specific (but possible uniform) error messages in other unpacking cases (see msg307999)?
FYI if a class implements __iter__ which returns non-iterable, the following error is raised:
>>> class C:
... def __iter__(self):
... return 1
...
>>> a, b = C()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: iter() returned non-iterator of type 'int'
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32259>
_______________________________________
More information about the Python-bugs-list
mailing list