We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 509455a commit c94fb3aCopy full SHA for c94fb3a
python-copy/person.py
@@ -56,8 +56,7 @@ def __replace__(self, **changes):
56
person_copy = copy.replace(person, age=24, name="Alice Smith")
57
58
vars_slots = lambda obj: {
59
- name: getattr(obj, name)
60
- for name in obj.__slots__
+ name: getattr(obj, name) for name in obj.__slots__
61
}
62
63
print(vars_slots(person))
@@ -84,7 +83,9 @@ def __replace__(self, **changes):
84
83
setattr(instance, name, value)
85
86
if age and dob:
87
- raise AttributeError("can't set both 'age' and 'date_of_birth'")
+ raise AttributeError(
+ "can't set both 'age' and 'date_of_birth'"
88
+ )
89
elif age:
90
dob = copy.replace(date.today(), year=date.today().year - age)
91
instance.date_of_birth = dob
0 commit comments