Hi,

Edit suggestion on the following page:
https://wiki.python.org/moin/Generators

> Here, we compose a square generator with the takewhile generator, to generate 
> squares less than 100

> Toggle line numbers

>     #add squares less than 100
>     square = (i*i for i in count())
>     bounded_squares = takewhile(lambda x : x< 100, square)
>     total = 0
>     for i in bounded_squares:
>        total += i

The above example requires an import of itertools. Hence I suggest the
following addition preceding the example:

> from itertools import count, takewhile

It took me a while to search this out in google! Being a newbie, I feel
that the aforementioned amendment smoothens my uphill learning curve.

Thanks,
r

-- 
(B.V. Raghav)
_______________________________________________
pydotorg-www mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pydotorg-www

Reply via email to