"/a" is not "/a" ?

Joshua Kugler joshua at joshuakugler.com
Fri Mar 6 20:44:45 CET 2009


Emanuele D'Arrigo wrote:

>>>> c = "/a"
>>>> d = "/a"
>>>> c == d
> True               # all good so far
>>>> c is d
> False             # eeeeek!
> 
> Why c and d point to two different objects with an identical string
> content rather than the same object?

Because you instantiated two difference objects.
http://docs.python.org/reference/datamodel.html#objects-values-and-types
should get you started on Python and objects.

j




More information about the Python-list mailing list