[docs] Error in text

John Baumgartner john.baumgartner at live.com
Fri Nov 5 07:51:30 CET 2010


Hi Team,
It's not technically a bug, but the following code (on page http://docs.python.org/tutorial/datastructures.html#functional-programming-tools) is claimed to compute primes, but it does not return only primes...

>>> def f(x): return x % 2 != 0 and x % 3 != 0
...
>>> filter(f, range(2, 25))
[5, 7, 11, 13, 17, 19, 23]
Sure, for the range given in the filter only primes are returned, but if this range was expanded, composites would sneak in.
Great docs though! I'm new to Python and the examples are fantastic.
Cheers,
John 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20101105/b9ea89ea/attachment-0001.html>


More information about the docs mailing list