[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

About the implementation of del in Python 3

Jussi Piitulainen <jussi.piitulainen at helsinki.fi>:

> Marko Rauhamaa writes:
>> While talking about addresses might or might not be constructive, let
>> me just point out that there is no outwardly visible distinction
>> between "address" or "identity".
> With a generational or otherwise compacting garbage collector there
> would be. I believe that to be a valid implementation strategy.
> Or you are using "address" in some abstract sense so that the "address"
> does not change when the internal representation of the object is moved
> to another location.

"Address" is just a word. In fact, I don't think there is any definition
in the Python data model that makes use of the term.

Personally, when talking about Python, I would regard "address" as an
endearing synonym for "identity".

>> Ignoring the word that is used to talk about object identity, it would
>> be nice to have a precise formal definition for it. For example, I
>> know that any sound implementation of Python would guarantee:
>>     >>> def f(a): return a
>>     ...
>>     >>> a = object()
>>     >>> a is f(a)
>>     True
>> But how do I know it?
> For me it's enough to know that it's the object itself that is passed
> around as an argument, as a returned value, as a stored value, as a
> value of a variable. This is the basic fact that lets me understand
> the behaviour and performance of programs.

That "definition" is very circular. You haven't yet defined what is
"object itself". The word "self", in partucular, looks like yet another
synonym of "identity".

Anyway, it would be nice to have an explicit statement in the language
definition that says that passing an argument and returning a value
preserve the identity.