Skip to content

Commit 459b055

Browse files
committed
Make deep copy optional at constructor
1 parent 7f63da9 commit 459b055

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

memento.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class Transaction:
2323
deep = False
2424
states = []
2525

26-
def __init__(self, *targets):
26+
def __init__(self, deep, *targets):
27+
self.deep = deep
2728
self.targets = targets
2829
self.commit()
2930

@@ -75,7 +76,7 @@ def do_stuff(self):
7576
num_obj = NumObj(-1)
7677
print(num_obj)
7778

78-
a_transaction = Transaction(num_obj)
79+
a_transaction = Transaction(True, num_obj)
7980
try:
8081
for i in range(3):
8182
num_obj.increment()

0 commit comments

Comments
 (0)