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.
Created on 2015年03月17日 13:44 by ers81239, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Messages (2) | |||
|---|---|---|---|
| msg238290 - (view) | Author: Edward (ers81239) | Date: 2015年03月17日 13:44 | |
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 |
|||
| msg238438 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2015年03月18日 13:38 | |
This is a specific case of the more general problem discussed in issue 12458. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:14 | admin | set | github: 67875 |
| 2015年03月21日 04:31:47 | r.david.murray | set | messages: - msg238746 |
| 2015年03月21日 04:31:32 | r.david.murray | set | files: - py2.JPG |
| 2015年03月21日 01:57:09 | SMRUTI RANJAN SAHOO | set | files:
+ py2.JPG nosy: + SMRUTI RANJAN SAHOO messages: + msg238746 |
| 2015年03月18日 13:38:38 | r.david.murray | set | status: open -> closed superseder: Tracebacks should contain the first line of continuation lines nosy: + r.david.murray messages: + msg238438 resolution: duplicate stage: resolved |
| 2015年03月17日 13:44:45 | ers81239 | create | |