Terry J. Reedy <tjre...@udel.edu> added the comment:

I think generically changing 'iterable' to 'iterable/unpackable' is wrong and 
would engender more confusion than at present.  Most uses of iteration have 
nothing to do with multiple assignment target unpacking.  Some minimal examples 
resulting in "TypeError: 'int' object is not iterable", where this change would 
be wrong, include

iter(1)
sorted(1)
for _ in 1: pass

What might be reasonable is to wrap iter(source) in multiple assignment target 
code with (the C equivalent, if it exists, of) try-except and augment the 
message before re-raising.  The addition could be something explicit like "and 
cannot be the source for multiple target assignment".

---
Camion, Steven gave you excellent advice about playing around with simplified 
code.  If you had split the multiple-operation error raising line,

for term, dgts in terms_generator(expected_precision):

into two simpler lines that each do less,

for value in terms_generator(expected_precision):
    term, dgts = value

you would have likely have spent much less time looking in the wrong place.  
Isolating possible exception sources is a very useful debugging tool.

----------
nosy: +terry.reedy

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32259>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to