I assumed sequence types in Python were value types. It turns out they’re reference types (Meaning that the value of a variable won’t be copied when assigned to a new variable, but referenced). So now I’m wondering, what are the value types in Python? That is, what types in Python can I assign to new variables without worrying that the variable was referenced?
I assumed sequence types in Python were value types. It turns out they’re reference
Share
All values in Python are references. What you need to worry about is if a type is mutable. The basic numeric and string types, as well as
tupleandfrozensetare immutable; names that are bound to an object of one of those types can only be rebound, not mutated.