Message238290
This code:
z = [
["Y" for y in None
] for x in range(4)
]
produces this stacktrace in both Python 2.7 and 3.4:
Traceback (most recent call last):
File "/Users/edwsmith/dev/untitled4/test.py", line 7, in <module>
] for x in range(4)
File "/Users/edwsmith/dev/untitled4/test.py", line 7, in <listcomp>
] for x in range(4)
TypeError: 'NoneType' object is not iterable
Of course my code was slightly more complex, but I lost a fair amount of time troubleshooting how the 'for x in range(4)' was evaluating to None, when really, it was the inner comprehension that was failing.
Ideally the stack trace would say:
Traceback (most recent call last):
File "/Users/edwsmith/dev/untitled4/test.py", line 6, in <module>
["Y" for y in None
File "/Users/edwsmith/dev/untitled4/test.py", line 6, in <listcomp>
["Y" for y in None
TypeError: 'NoneType' object is not iterable |
|
Date |
User |
Action |
Args |
2015-03-17 13:44:45 | ers81239 | set | recipients:
+ ers81239 |
2015-03-17 13:44:45 | ers81239 | set | messageid: <1426599885.89.0.0578302709073.issue23687@psf.upfronthosting.co.za> |
2015-03-17 13:44:45 | ers81239 | link | issue23687 messages |
2015-03-17 13:44:45 | ers81239 | create | |
|