Steven D'Aprano <st...@pearwood.info>:

> On Wed, 2 Mar 2016 08:03 pm, Jesper K Brogaard wrote:
>
>> As I understand it, when you use 'is', you are comparing addresses to
>> objects, not the values contained in the objects. Use '==' instead.
>
> You should not think about addresses, because the location of objects
> is not part of the language. It is implementation-dependent.

The ontological question is, can two *distinct* objects with *identical*
characteristics exist?

The fermionic answer is, no.

The bosonic answer is, sure.

Set theory has fermionic ontology (it's called extensionality).

Python sits on the fence on that one, allowing either ontology.

> This is why the id() function is NOT documented as returning the
> address of an object, but of returning an ID number. Let's look at IDs
> in IronPython:
>
>>>> a, b, c = [], 10000, "Hello world!"
>>>> print id(a), id(b), id(c), id(None)
> 43 44 45 0
>
>
> And in Jython:
>
>>>> a, b, c = [], 10000, "Hello world!"
>>>> print id(a), id(b), id(c), id(None)
> 1 2 3 4

Python doesn't define or use the concept of an "address."


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to