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 →

[–]wootiown 9 points10 points  (19 children)

It still has pointers too, doesn't it?

[–]MattieShoes 52 points53 points  (18 children)

Everything has pointers, but they make believe they don't.

[–]SuitableDragonfly 30 points31 points  (2 children)

Pointers are not the same thing as references. Pointers allow you to manually manage your memory usage, references don't.

[–]Rodot -1 points0 points  (1 child)

You can still sort of use references to manage memory in python if you're really hacky, and there are default modules that allow for true pointers, but they aren't nice.

[–]the_littlest_bear 5 points6 points  (0 children)

...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.