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 |
Explain me dogpile effect? How can you prevent this effect?
What does %s mean in python?
Are methods objects in python?
How to find whether string is alphanumeric or not?
Tell me how does python handle the memory management?
How to sort a dictionary by value in python?
What happened if we call a key that is not present in dictionary and how to tackle that kind of error ?
How we can send email from python?
Is it easy to learn python?
How does Python handle the memory management?
is Python similar to ruby?
What is super () in python?