On Tue, 30 Nov 2004 14:18:30 +0100, Diez B. Roggisch wrote: >>>>> l = [] >>>>> 0 in (l is False) >> Traceback (most recent call last): >> File "<stdin>", line 1, in ? >> TypeError: iterable argument required > > that should be clear - 0 in False can't work.
yes, I forget to mention that it was the third expression which was bugging me. >>>>> (0 in l) is False >> True >>>>> 0 in l is False >> False > > It seems to stem from a behaviour python exhibits in expressions like > this: > > 3 > 2 > 1 > > This yields True, while > > (3 > 2 ) > 1 > > yields false. Chaining of operators gets translated like this: > > 3 > 2 and 2 > 1 > > Look in section 5.9 of the language reference. > > Then your expression gets translated to: > > 0 in l and l is False > > which yields False of course. thanks, I had missed this part of the language reference ! Not yet found an misbehaviour in python... ;) -- Sylvain Thénault LOGILAB, Paris (France). http://www.logilab.com http://www.logilab.fr http://www.logilab.org -- http://mail.python.org/mailman/listinfo/python-list