[Tutor] Looks like a judgment bug.

Timo timomlists at gmail.com
Thu Apr 11 13:20:43 CEST 2013


Op 11-04-13 12:41, w qj schreef:
> I found this under Windows Python3
>>>> l="http://f/"
>>>> l[-1] is not '/'
> False
> and this under Linux Python3
>>>> l = "http://ff.f/"
>>>> l[-1]
> '/'
>>>> l[-1] is not '/'
> True
>
> It's Looks like a python bug?
This looks like a "is not" versus "!=" thing. Someone (I think Steven 
Apprano) posted a couple of days ago on this mailing list to only use 
"is" and "is not" when comparing to None.

It works fine with regular operators.

$ python3
Python 3.2.3 (default, Oct 19 2012, 19:53:16)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> l = "http://ff.f/"
 >>> l[-1]
'/'
 >>> l[-1] is not '/'
True
 >>> l[-1] != '/'
False


Timo

> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list