About the implementation of del in Python 3

MRAB python at mrabarnett.plus.com
Thu Jul 6 10:56:13 EDT 2017


On 2017-07-06 15:29, Jussi Piitulainen wrote:
> 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.
> 
>> 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.
> 
Perhaps you should be thinking of it as passing around the end of a 
piece of string, the other end being tied to the object itself. :-)



More information about the Python-list mailing list