pprinting generators

Ville Vainio vvainio at tp.spt.fi
Fri Jun 28 08:42:36 EDT 2002


On 2.2.1, pprint.pprint doesn't seem to be able to handle generators:


>>> from __future__ import generators
>>> def f(): yield 0
...
>>> import pprint
>>> pprint.pprint(f())
<generator object at 0x007F91D0>

Surely pprint could be more helpful with generators, iterating through
them fully or just n first elements, or whatever. Or is this a design
decision with pprint?

-- Ville



More information about the Python-list mailing list