This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author enchyisle
Recipients docs@python, enchyisle
Date 2014-11-14.06:34:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1415946863.39.0.61005418871.issue22868@psf.upfronthosting.co.za>
In-reply-to
Content
Hi, I suppose there is a minor error in the example of the filter() function in 5.1.3 part of the document.

------------------------------------------------------------------
filter(function, sequence) returns a sequence consisting of those items from the sequence for which function(item) is true. If sequence is a string or tuple, the result will be of the same type; otherwise, it is always a list. For example, to compute a sequence of numbers not divisible by 2 or 3:

>>>
>>> def f(x): return x % 2 != 0 and x % 3 != 0
...
>>> filter(f, range(2, 25))
[5, 7, 11, 13, 17, 19, 23]
------------------------------------------------------------------

I think what the example does is "to compute a sequence of numbers not divisible by 2 and 3", not "2 or 3".
History
Date User Action Args
2014-11-14 06:34:23enchyislesetrecipients: + enchyisle, docs@python
2014-11-14 06:34:23enchyislesetmessageid: <1415946863.39.0.61005418871.issue22868@psf.upfronthosting.co.za>
2014-11-14 06:34:23enchyislelinkissue22868 messages
2014-11-14 06:34:22enchyislecreate