Modifying Class Object

Duncan Booth duncan.booth at invalid.invalid
Wed Feb 10 08:56:03 EST 2010


"Alf P. Steinbach" <alfps at start.no> wrote:

>> In CPython objects once created remain in the same memory location
>> (and their id is their address). Compare that to IronPython where the
>> objects themselves can move around in memory so they have no fixed
>> address. Try comparing the IronPython implementation to C pointers
>> and you'll cause a lot of confusion. e.g. someone might think the
>> id() value is in some way related to an address.
> 
> Did you /read/ what you quoted?
> 
> 
>> Ruby implements integers without using any pointers at all: there's
>> nothing in the Python specification which prevents a Python
>> implementation doing the same for small integers, in fact I believe
>> it has been tried but wasn't found to improve performance.
> 
> All theree of your points about Python are wrong; I don't know about
> the Ruby point. 

Would you care to expand upon your claim that my three points about Python 
are wrong? Are you saying that CPyhton objects move around, or that 
IronPython objects are fixed to a single memory location or that their id 
is related to their address? Clue here:

IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.3082
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 42
>>> id(x)
43
>>> y = 43
>>> id(y)
44
>>> z = "whatever"
>>> id(z)
45

-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list