In article <[EMAIL PROTECTED]>, Mel <[EMAIL PROTECTED]> wrote:

> Ben Finney wrote:
> 
> > "David C. Ullrich" <[EMAIL PROTECTED]> writes:
> > 
> >> >>> 'ab' in 'abc'
> >> True
> >> >>> [1,2] in [1,2,3]
> >> False
> > 
> > <URL:http://www.python.org/doc/ref/comparisons.html>
> > 
> >> Is there a reason for the inconsistency?
> > 
> > Probably. The special behaviour of string types was changed in Python
> > 2.3, according to that document.
> 
> As it stands, you'd get  
> 
> [1,2] in [1,2,3] == False
> 
> [1,2] in [1, [1,2], 3] == True
> 
> 
> This could be a good thing.

Oh, of course that's a good thing - changing "in" for lists
to give True there would be awful. I was wondering why it
_does_ work that way for strings.

Maybe the answer is "because it can" - for strings the sort
of possible problem you point out can't come up.

>         Mel.
> >

-- 
David C. Ullrich
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to