not and is not problem

Arnaud Delobelle arnodel at googlemail.com
Mon Jan 18 16:55:10 CET 2010


On 18 Jan, 15:43, superpollo <ute... at esempio.net> wrote:
> hi:
>
> #!/usr/bin/env python
> data = "seq=123"
> name , value = data.split("=")
> print name
> print value
> if not name == "seq":
>      print "DOES NOT PRINT OF COURSE..."
> if name is not "seq":
>      print "WTF! WHY DOES IT PRINT?"
>
> help please.
>
> bye

is and == are different operators.

    * A == B means A.__eq__(B)

    * A is B means that A and B are the same object, living at
the same physical location in the computer's memory.

HTH

--
Arnaud



More information about the Python-list mailing list