class-decorator Questions
2
Solved
I want to create decorator that shows which parameters were passed to function and methods. I have already written the code for functions, but methods are giving me a headaches.
This is func...
Defection asked 5/9, 2019 at 14:4
2
I have a superclass that has a retrieve() method, and its subclasses each implement their own retrieve() method. I'd like every retrieve() method to be decorated to cache the return value when it r...
Cogitate asked 19/7, 2019 at 0:56
2
Solved
Full code example:
def decorator(class_):
class Wrapper:
def __init__(self, *args, **kwargs):
self.instance = class_(*args, **kwargs)
@classmethod
def __getattr__(cls, attr):
return getattr...
Syncytium asked 19/12, 2017 at 16:56
1
© 2022 - 2024 — McMap. All rights reserved.