Augmented generators?

Raymond Hettinger python at
Tue Jan 10 14:11:20 EST 2006

Andrew Koenig wrote:
> Can anyone think of an easy technique for creating an object that acts like
> a generator but has additional methods?

Perhaps the enable_attributes() recipe will help:

The recipe imbues generators with classlike attribute reads and writes.
 It shouldn't be hard to adapt the technique for attaching methods.


More information about the Python-list mailing list