"in"consistency?

David C. Ullrich dullrich at sprynet.com
Mon Jul 7 23:23:43 CEST 2008


Luckily I tried it before saying no, that's
not how "in" works:

>>> 'ab' in 'abc'
True
>>> [1,2] in [1,2,3]
False

Is there a reason for the inconsistency? I would
have thought "in" would check for elements of a
sequence, regardless of what sort of sequence it was...

-- 
David C. Ullrich



More information about the Python-list mailing list