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 |
Why python is the best?
Explain the dictionary in Python.
What is the use of the // operator?
Can I learn python on my own?
Do we need to call the explicit methods to destroy the memory allocated in python?
Which is faster tuple or list?
Explain inheritance in python with example?
Draw a comparison between the range and xrange in python?
Is Django written in Python?
How do you sort a list in python?
What are the ones that can be used with pandas?
What is super in python class?