Use of "Pointers" or References for "memory management" in python? -
how might 1 go constructing linked list in python. realize python not low level. suppose have large object, , want contain reference large object in instances of class:
class largeobject: def __init__(self): # use lots of memory class smallobject: def __init__(self, large_object_ref): self.large_object_ref = large_object_ref # ... largeobj = largeobject() smallobj = smallobject(largeobj) # happens in memory?
i want ensure self.large_object_ref
never becomes deep copied instance of largeobject
in memory, how prevent this/ensure this?
i admit know little python's memory model or management, 1 isn't supposed have in python. familiar c/++ though borrowing terms , ideas area.
python pass-by-assignment equal pass-by-reference mutable objects (and of user-created objects mutable).
Comments
Post a Comment