Infinite lists and generators

Luigi Ballabio ballabio at mac.com
Wed Nov 14 07:23:46 EST 2001


At 01:29 AM 11/14/01 -0800, Paul Rubin wrote:
>Luigi Ballabio <ballabio at mac.com> writes:
> >       I've been reading a few back issues of the Perl Journal, and I
> > came across an article on implementing infinite lists in Perl. Just
> > for fun I went ahead and reimplemented it in Python---I know someone
> > probably did already, but as I said, it was for fun. Also, I've
> > written a test suite which showcases a few tricks such as building the
> > list of all prime numbers, of the Hamming numbers, and the power
> > series of exp, sin and cos. I'm including the file below.
> >
> > My question is: how does one go about pulling such stunts with
> > generators instead?
>
>You might like to read the book Structure and Interpretation of
>Computer Programs, by Abelson and Sussman.  The entire text is online at:
>
>   http://mitpress.mit.edu/sicp/sicp.html

Paul,
         you might notice from the comments in the file that the power 
series tricks in the test suite were taken from SICP :)

It was nice of you to post the link though, since
a) I hadn't included it
b) it should be mandatory reading for anyone who calls himself a programmer :)

Bye,
         Luigi





More information about the Python-list mailing list