fork(1) download
  1.  
  2. class SomeDecorator:
  3.  
  4. def __init__(some_attribute):
  5. self.some_attribute = some_attribute
  6.  
  7. def __call__(self, func):
  8. @wraps(func)
  9. def inner(*args, **kwargs):
  10. if isinstance(some_attribute, list):
  11. self.some_attribute = another_param
  12. "do some logic"
  13.  
  14. return func(*args, **kwargs)
  15. return inner
  16.  
  17. "____________________________________________________________"
  18.  
  19. @SomeDecorator(some_attribute = [Class1, Class2])
  20. def my_api_function(*args, **kwargs):
  21. "do some logic"
  22. return "some object"
Runtime error #stdin #stdout #stderr 0.15s 23532KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 19, in <module>
NameError: name 'Class1' is not defined