]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
Make 'x in y' and 'x not in y' (PySequence_Contains) play nice w/ iterators.
authorTim Peters <tim.peters@gmail.com>
Sat, 5 May 2001 10:06:17 +0000 (10:06 +0000)
committerTim Peters <tim.peters@gmail.com>
Sat, 5 May 2001 10:06:17 +0000 (10:06 +0000)
commitde9725f1352856b7d6de1bb29383a7be5f181740
tree3fff3245c5dff4684440f7e9227c34bed9ef27b5
parent2cfe36828342e16cd274b968736a01aed5c49557
Make 'x in y' and 'x not in y' (PySequence_Contains) play nice w/ iterators.
NEEDS DOC CHANGES
A few more AttributeErrors turned into TypeErrors, but in test_contains
this time.
The full story for instance objects is pretty much unexplainable, because
instance_contains() tries its own flavor of iteration-based containment
testing first, and PySequence_Contains doesn't get a chance at it unless
instance_contains() blows up.  A consequence is that
    some_complex_number in some_instance
dies with a TypeError unless some_instance.__class__ defines __iter__ but
does not define __getitem__.
Lib/test/test_contains.py
Lib/test/test_iter.py
Misc/NEWS
Objects/abstract.c
Objects/object.c