Message308443
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. |
|
Date |
User |
Action |
Args |
2017-12-16 03:37:03 | terry.reedy | set | recipients:
+ terry.reedy, rhettinger, eric.smith, steven.daprano, r.david.murray, serhiy.storchaka, Camion |
2017-12-16 03:37:02 | terry.reedy | set | messageid: <1513395422.93.0.213398074469.issue32259@psf.upfronthosting.co.za> |
2017-12-16 03:37:02 | terry.reedy | link | issue32259 messages |
2017-12-16 03:37:01 | terry.reedy | create | |
|