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 jneb
Recipients jneb
Date 2014-03-17.14:17:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1395065869.95.0.783966483031.issue20959@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2014-03-17 14:17:49jnebsetrecipients: + jneb
2014-03-17 14:17:49jnebsetmessageid: <1395065869.95.0.783966483031.issue20959@psf.upfronthosting.co.za>
2014-03-17 14:17:49jneblinkissue20959 messages
2014-03-17 14:17:49jnebcreate