obj_copyΒΆ
obj_copy creates a copy of an object.
-
o = obj_copy(obj)
Return Value
o is the copied object of obj.
Parameters
-
obj
obj is an object created with obj_create.
Example
o = obj_create()
o.a = 1
o.b = 2
o2 = o.copy()
print o2.a
print o2.b
Comment
The function can also copy objects with references, e.g.:
o = obj_create()
o.val = 123
o.next = obj_create()
o.next.val = 456
o.next.next = o
a = o.copy()
The function copies the parent object and the object with the methods. After
a = o.copy()
a
and o
have the same parent object and the
same object with the methods.
id-189522