weird behaviour of "0 in [] is False"

Sylvain Thenault sylvain.thenault at nospam.logilab.fr
Tue Nov 30 13:57:59 CET 2004


Hi there !

Can someone explain me the following behaviour ?

>>> l = []
>>> 0 in (l is False)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: iterable argument required
>>> (0 in l) is False
True
>>> 0 in l is False
False


This is really obscur to me...

-- 
Sylvain Thénault                               LOGILAB, Paris (France).

http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org





More information about the Python-list mailing list