[Python-Dev] string.find() again (was Re: timsort for jython)
Guido van Rossum
guido@python.org
Mon, 05 Aug 2002 15:16:18 -0400
> In testing this patch, I ran across this:
>
> >>> 's' in 's'
> True
> >>> 's' in 's' == True
> False
> >>> 's' in 's' is True
> False
> >>> id('s' in 's')
> 135246792
> >>> id(True)
> 135246792
>
> What's up with that? Am I missing something?
Yes, 'is' and'in' and '==' are all comparison operators, and the
chaining syntax makes this interpreted as (roughly)
('s' in 's') and ('s' == True)
('s' in 's') and ('s' is True)
--Guido van Rossum (home page: http://www.python.org/~guido/)