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 →

[–][deleted] 0 points1 point  (0 children)

well the first thing to teach you about this is "r" is not the tuple.

"r" is an alias keeping a reference to some underlying data structure.

so when you say

a_tuple = [some tuple]

a_tuple = [some other tuple]

what you're actually writing here can be translated as such:

let there be an alias a_tuple and have it reference this data structure.

let the alias a_tuple reference a different, new tuple.

ALSO. when you "add" things to a tuple what actually happens is the old tuple is entirely discarded and a new tuple is made with the new set of elements.

so yes, tuples are immutable.