In article <[EMAIL PROTECTED]>, Nick Dumas <[EMAIL PROTECTED]> wrote:
> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > [1,2] in [1,2,3] checks to see if the list [1,2] is an item in [1,2,3]. > Because the list [1,2,3] only contains the integers 1,2,3, the code > returns a False. Try "[1,2] in [[1,2],[2,3]]" Thanks. I understand how it works for lists and why - I was wondering why it's not the same for strings. > David C. Ullrich wrote: > > 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... > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (MingW32) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkhyiwEACgkQLMI5fndAv9jbiwCeKMXrAclILJMPro5VuSRgdkvB > cGkAn1igcjFWRQJSwEDOxpk3spzceZGa > =iq8L > -----END PGP SIGNATURE----- -- David C. Ullrich -- http://mail.python.org/mailman/listinfo/python-list