Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc856491

Browse files
authored
Corrected erroneous example
1 parent8a9ef25 commitc856491

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
classDecorateMyMethod:
109109

110-
defdecorator_for_class_method(method):
111-
defwrapper_for_class_method(self,*args,**kwargs)
110+
defdecorator_for_class_method_with_no_args(method):
111+
defwrapper_for_class_method(self)
112112
try:
113-
return method(self,*args,**kwargs)
113+
return method(self)
114114
exceptExceptionas 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
defclass_action(self):
124124
ifself.succeed:
125125
print("You succeeded by choice.")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp