Modifying Class Object

Alf P. Steinbach alfps at
Thu Feb 11 09:09:04 CET 2010

* I V:
> On Thu, 11 Feb 2010 07:37:35 +0100, Alf P. Steinbach wrote:
>> * Steven D'Aprano:
>>> s = [1]
>>> t = s         # Binds the name t to the object bound to the name s.
>>> t[0] = 2      # Changes the object bound to the name t print(s)      #
>>> Checks the object via the original name.
>>> Notice that your version describes what happens according to some
>>> implementation, below the level of the Python virtual machine.
>> Consider just the
>>    assert( t is not s )
>>    t = s
>> Does this change anything at all in the computer's memory?
>> If it doesn't, then it has no effect whatsoever.
>> But since it does have an effect, a memory change has been effected.
> I don't think your disagreeing with Steven here - by talking about "the 
> computers memory," it's clear that you are talking about the details of 
> an implementation of python, not the semantics of python itself. Unless, 
> of course, you are under the misapprehension that "the computer's memory" 
> is relevant to the python language, rather than the particular 
> implementation. Python itself has nothing to do with "computers" or 
> "memory"; these are mere implementation details.

You know, the programming language that doesn't need computers: Python.



- Alf (not sure how to read your posting, but it's funny anyhow)

More information about the Python-list mailing list