Intermediate Python
Q89 / 101

What is the difference between deepcopy and pickle for copying objects?

Correct! Well done.

Incorrect.

The correct answer is B) deepcopy creates an in-memory copy; pickle serializes to bytes (can be saved to disk or sent over network) and uses __reduce__ for custom behavior

B

Correct Answer

deepcopy creates an in-memory copy; pickle serializes to bytes (can be saved to disk or sent over network) and uses __reduce__ for custom behavior

Explanation

deepcopy() handles circular references and complex objects in memory. pickle serializes to a byte stream. Both can handle custom objects but via different mechanisms.

Progress
89/101