[Python-Dev] string.find() again (was Re: timsort for jython)
Skip Montanaro
skip@pobox.com
Tue, 6 Aug 2002 09:47:57 -0500
Samuele> If
Samuele> "thon" in "python"
Samuele> then why not
Samuele> [1,2] in [0,1,2,3]
Samuele> (it's a purely rhetorical question)
Samuele> in general I don't think it is a good idea to have "in" be a
Samuele> membership vs subset/subseq operator depending on non
Samuele> ambiguity, convenience or simply implementer taste, because
Samuele> truly there are data types (ex. sets) that would need both and
Samuele> disambiguated.
Perhaps it makes sense to allow "'thon' in 'python'" to return True, but
still have "[1,2] in [0,1,2,3]" return False if we loosen the steadfast
requirement that strings and lists be as much alike as possible. That is,
while both are sequences, we take advantage of the distinction between their
basic structures (sequence of characters vs. sequeunce of arbitrary
objects).
Skip