Ben Sizer wrote:
> But do you have an example of such a use case?
here's what I think is the first published example that uses "yield" for
co-routine-like behaviour:
http://effbot.org/zone/asyncore-generators.htm
that snippet uses a generator to implement a simple network protocol.
the generator yields a status code when it needs more data from the
framework, and the framework uses an instance variable (self.data) to
pass information into the generator.
Python 2.5 lets you eliminate the instance variable; instead of using an
external shared variable, the framework can use "send" to pass data into
the generator, and the generator can use ordinary expression syntax to
pick it up.
</F>
--
http://mail.python.org/mailman/listinfo/python-list