Asked by Joe
Which way is the correct way of copying (deepcopy) object_1 to object_2? (A is a class)
class A:
def __init__(self):
self.x
self.y
a)object_1 = A()
object_2.x = object_1.x
object_2.y = object_1.y
b) object_1 = A()
object_2.x = object_1.x
object_2.y = object_1.y
#OR
object_1 = A()
object_2 = object_1
c) object_1 = A()
object_2 = A()
object_2.x = object_1.x
object_2.y = object_1.y
d) object_1 = A()
object_2 = object_1
class A:
def __init__(self):
self.x
self.y
a)object_1 = A()
object_2.x = object_1.x
object_2.y = object_1.y
b) object_1 = A()
object_2.x = object_1.x
object_2.y = object_1.y
#OR
object_1 = A()
object_2 = object_1
c) object_1 = A()
object_2 = A()
object_2.x = object_1.x
object_2.y = object_1.y
d) object_1 = A()
object_2 = object_1
Answers
There are no human answers yet.
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.