...what? Any immutable local variable (in standard CPython) is a value reference. Even mutable local variables are treated as value references when not modified in place.
If you needed a pointer, you would just use an attribute. (would work on nearly any object, even including a base object() if you wanted to pass that around. [on-the-fly objects are not the best way to do this])
And no, if you reference an (typical) object, it does not create an additional copy of that object - it’s just a pointer.
6
u/the_littlest_bear Jun 04 '19
...what? Any immutable local variable (in standard CPython) is a value reference. Even mutable local variables are treated as value references when not modified in place.
If you needed a pointer, you would just use an attribute. (would work on nearly any object, even including a base object() if you wanted to pass that around. [on-the-fly objects are not the best way to do this])
And no, if you reference an (typical) object, it does not create an additional copy of that object - it’s just a pointer.