Characters contain themselves?

gry at ll.mit.edu gry at ll.mit.edu
Fri Apr 7 10:25:01 EDT 2006


In fact, not just characters, but strings contain themselves:

>>> 'abc' in 'abc'
True

This is a very nice(i.e. clear and concise) shortcut for:

>>> 'the rain in spain stays mainly'.find('rain') != -1
True

Which I always found contorted and awkward.

Could you be a bit more concrete about your complaint?

-- George
[Thanks, I did enjoy looking up the Axiom of Foundation!]




More information about the Python-list mailing list