references/addrresses in imperative languages
agriff at tin.it
Wed Jun 22 01:27:32 CEST 2005
On 20 Jun 2005 23:30:40 -0700, "Xah Lee" <xah at xahlee.org> wrote:
>Dear Andrea Griffini,
>Thanks for explaning this tricky underneath stuff.
Actually it's the very logical consequence of the most
basic rule about python. Variables are just pointers
to values; so every time you assign to a variable
you're always changing just that pointer, you're not
touching the object pointed to by the variable.
Even when x is pointing to an integer with x=x+1
you are computing a new integer (x+1) and making
x to point to this new one instead of the old one.
You are NOT touching the old integer.
Surely this is different from C/C++/Java, but it's
IMO all but tricky or underneath.
More information about the Python-list