Good Python generators example?
David Eppstein
eppstein at ics.uci.edu
Sun Apr 20 20:40:11 EDT 2003
Robert> Can someone point me to a nice concise Python 2.2 compatible
Robert> example of the use of generators?
There are a bunch of them at
http://aspn.activestate.com/ASPN/Cookbook/Python?kwd=Algorithms
A couple of mine:
Sieve of Eratosthenes prime number generator
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/117119
Use of generators in the middle of an algorithm for finding farthest
pairs of points
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/117225
--
David Eppstein http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science
More information about the Python-list
mailing list