OOP & Design Patterns - Prototype Pattern - Deep Copy vs Shallow Copy
Identify the subtle bug in the following Python code implementing a deep copy method for a Profile class:
import copy
class Profile:
def __init__(self, name, scores):
self.name = name
self.scores = scores
def __deepcopy__(self, memo):
new_name = copy.deepcopy(self.name)
new_scores = copy.deepcopy(self.scores, memo)
return Profile(new_name, new_scores)
