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 2014年03月17日 14:17 by jneb, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg213869 - (view) | Author: Jurjen N.E. Bos (jneb) * | Date: 2014年03月17日 14:17 | |
One of the more interesting ways to use print is printing output of a generator, as print(*generator()). But if the generator generates a typeError, you get a very unhelpful error message: >>> #the way it works OK >>> def f(): yield 'a'+'b' ... >>> print(*f()) ab >>> #Now with a type error >>> def f(): yield 'a'+5 ... >>> print(*f()) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: print() argument after * must be a sequence, not generator The problem is twofold: - the message is plainly wrong, since it does work with a generator - the actual error is hidden from view |
|||
| msg214053 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2014年03月19日 05:04 | |
Yet another duplicate of Issue 4806, by the looks |
|||
| msg214054 - (view) | Author: Ned Deily (ned.deily) * (Python committer) | Date: 2014年03月19日 05:32 | |
Thanks for the report. And thanks for noting the duplicate, Martin. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:00 | admin | set | github: 65158 |
| 2014年03月19日 05:32:26 | ned.deily | set | status: open -> closed superseder: Function calls taking a generator as star argument can mask TypeErrors in the generator nosy: + ned.deily messages: + msg214054 resolution: duplicate stage: resolved |
| 2014年03月19日 05:04:11 | martin.panter | set | nosy:
+ martin.panter messages: + msg214053 |
| 2014年03月17日 14:17:49 | jneb | create | |