Explain how to copy an object in Python.



Explain how to copy an object in Python...

Answer / chaitanya

There are two ways in which objects can be copied in python.

Shallow copy & Deep copy.

Shallow copies duplicate as minute as possible whereas Deep copies duplicate everything.

If a is object to be copied then

-copy.copy(a) returns a shallow copy of a.

-copy.deepcopy(a) returns a deep copy of a.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

What are the different types of reuest in python?

0 Answers  


Is numpy faster than pandas?

0 Answers  


What is pydoc command?

0 Answers  


Does python have polymorphism?

0 Answers  


Tell me what is the command to debug a python program?

0 Answers  






What is lambda? Why do lambda forms not have statements?

0 Answers  


What is the difference between while and for loop?

0 Answers  


What are domains and tuples?

0 Answers  


You mentioned pypi in your previous answer. Can you elaborate?

0 Answers  


Is null in python?

0 Answers  


Is python time time utc?

0 Answers  


Explain about pickling and unpickling?

0 Answers  


Categories