On 29 авг, 20:25, "Günther Dietrich" <gd_use...@spamfence.net> wrote:
> Paul McGuire <pt...@austin.rr.com> wrote:
> >What exactly are you trying to do?
>
> I think, he wants to kind of dereference the list element. So that he
> can write
>
> >>> a += 1
>
> instead of
>
> >>> long_name_of_a_list_which_contains_data[mnemonic_pointer_name] += 1
>
> Regards,
>
> Günther

That's right. I thought that int as object will stay the same object
after += but with another integer value.
My intuition said me that int object which represent integer value
should behave this way.
But by design python's integer behave differently.

I fond that NumPy's 1-d types behaves as objects with mutable values.

>>> from numpy import *

>>> a=array([1])
>>> id(a)
10912544
>>> a += 1
>>> id(a)
10912544
>>> a
array([2])
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to