Verzeichnis für teil28
This commit is contained in:
13
teil28/counter.py
Normal file
13
teil28/counter.py
Normal file
@@ -0,0 +1,13 @@
|
||||
#Datei: counter.py
|
||||
|
||||
def counter(func):
|
||||
func.count = 0
|
||||
def wrapper(*args, **kwargs):
|
||||
func.count = func.count +1
|
||||
print(f'{func.__name__} wurde {func.count}-mal aufgerufen.')
|
||||
result = func(*args,**kwargs)
|
||||
|
||||
return result
|
||||
wrapper.count = 0
|
||||
return wrapper
|
||||
|
Reference in New Issue
Block a user