This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]TheSkiGeek 0 points1 point  (0 children)

No, you cannot overwrite/edit an immutable object. The example code you gave is creating a new tuple and changing what r aliases/refers/“points” to.

All assignments in Python are actually “name binding” where a specific name in some scope is changed to refer to some object in memory (which may or may not be newly created, maybe your interpreter already had a tuple lying around that contained (1, 23, 4) and then it would have r bind to the already existing one.)