Preferences

In Python, no user object is modified by a simple assignment to a name. It just binds it.

It is not about mutable/immutable objects , it is about using a name for a single purpose within given scope.

    a = 1
    b = 2
    a = b
"a" name refers to the "2" object. "1" hasn't changed (ints are immutable in Python). If nothing else references it, it might as well disappear (or not).

Though both "single purpose" and immutability may be [distinct] good ideas.


This item has no comments currently.

Keyboard Shortcuts

Story Lists

j
Next story
k
Previous story
Shift+j
Last story
Shift+k
First story
o Enter
Go to story URL
c
Go to comments
u
Go to author

Navigation

Shift+t
Go to top stories
Shift+n
Go to new stories
Shift+b
Go to best stories
Shift+a
Go to Ask HN
Shift+s
Go to Show HN

Miscellaneous

?
Show this modal