Skip to content

Commit c856491

Browse files
authored
Corrected erroneous example
1 parent 8a9ef25 commit c856491

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/cheatsheet/decorators.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ To decorate a class methos, you must define the decorator within the class. When
107107
```python
108108
class DecorateMyMethod:
109109

110-
def decorator_for_class_method(method):
111-
def wrapper_for_class_method(self, *args, **kwargs)
110+
def decorator_for_class_method_with_no_args(method):
111+
def wrapper_for_class_method(self)
112112
try:
113-
return method(self, *args, **kwargs)
113+
return method(self)
114114
except Exception as e:
115115
print("\nWARNING: Please make note of the following:\n")
116116
print(e)
@@ -119,7 +119,7 @@ class DecorateMyMethod:
119119
def __init__(self,succeed:bool):
120120
self.succeed = succeed
121121

122-
@wrapper_for_class_method
122+
@decorator_for_class_method_with_no_args
123123
def class_action(self):
124124
if self.succeed:
125125
print("You succeeded by choice.")

0 commit comments

Comments
 (0)