Open Borda opened 8 months ago
Here is the code for detecting static:
def is_function_static(func):
for obj in globals().values():
if inspect.isclass(obj) and hasattr(obj, func.__name__) and func.__name__ in obj.__dict__:
method = obj.__dict__[func.__name__]
if method is not None and isinstance(method, staticmethod):
return True
return False
OK. Finally read that.
I tend to agree.
Every useful functionality of the current implementation with methods can be used by writing a static helper function and caching it using cachier
instead. Thus, I would feel comfortable with blocking this use, with a note of this proper related use.
But is the same true for class methods? Help me think. Let's try to challenge our selves here.
well, you can set by default some global config with strict validation, and if a user wants he would allow weak checks..
Ok. Agreed. So it can be on by default, and you can opt-out with a config.
In the readme, it is set that a class method shall not be cased if they use self, but nothing prevents top so, and the user can easily fall to wrong values; I think that we shall allow ONLY static methods and raise exceptions on anything else without making make many assumptions if the code is safe...