py3k printing generators -- not!

samwyse samwyse at
Sat Jun 6 14:28:30 CEST 2009

The one thing that's killing me in Python 3000 is that every time I
try to print something, it seems like I get <generator object
<genexpr> at 0x01BAF508>.  Googling only found one reference, a
posting elsewhere by one Carl Johnson (aka carlj7,,
which apparently was never answered.  Is anyone else finding this
bothersome, or is it entirely due to my FP background?

Always saying "print(','.join(x))" gets tiresome in a hurry.  I've
thought about defining my own function "prnt" that wraps print and
fixes generators, but that requires me to get their type, which
despite the claims of "help(type(x for x in range(0)))" cannot be
found in builtins.  How are other solving this?

More information about the Python-list mailing list