This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients Camion, eric.smith, r.david.murray, rhettinger, serhiy.storchaka, steven.daprano, terry.reedy
Date 2017-12-16.03:37:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1513395422.93.0.213398074469.issue32259@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-12-16 03:37:03terry.reedysetrecipients: + terry.reedy, rhettinger, eric.smith, steven.daprano, r.david.murray, serhiy.storchaka, Camion
2017-12-16 03:37:02terry.reedysetmessageid: <1513395422.93.0.213398074469.issue32259@psf.upfronthosting.co.za>
2017-12-16 03:37:02terry.reedylinkissue32259 messages
2017-12-16 03:37:01terry.reedycreate