Some exellent technical practice in the development ofJuq.Decorators for functions in a moduledefdecarate_module(module,decorator:types.FunctionType):fornameindir(module):method=getattr(module,name)ifisinstance(method,types.FunctionType):setattr(module,name,decorator(method))returnmoduleUsage: e.g. Serialize all return values for functions in a moduledataclassReasone.g.defExample(object):def__init__(self,a:int,b:str,c:str,d:str,e:str,f:str,g:str,...):self.a=aself.b=bself.c=c...Common method of constructor is a waste of time and code space.
...
继续阅读
(45)