I would like to have in the code underneath that when i type instance_of_A = A(
, that the name of the supposed arguments is init_argumentA
and not *meta_args, **meta_kwargs
. But unfortunatally, the arguments of the __call__
method of the metaclass are shown.
class Meta(type):
def __call__(cls,*meta_args,**meta_kwargs):
# Something here
return super().__call__(*meta_args, **meta_kwargs)
class A(metaclass = Meta):
def __init__(self,init_argumentA):
# something here
class B(metaclass = Meta):
def __init__(self,init_argumentB):
# something here
I have searched for a solution and found the question How to dynamically change signatures of method in subclass? and Signature-changing decorator: properly documenting additional argument. But none, seem to be completely what I want. The first link uses inspect to change the amount of variables given to a function, but i can't seem to let it work for my case and I think there has to be a more obvious solution. The second one isn't completely what I want, but something in that way might be a good alternative.
Edit: I am working in Spyder. I want this because I have thousands of classes of the Meta type and each class have different arguments, which is impossible to remember, so the idea is that the user can remember it when seeing the correct arguments show up.
help()
or documentation builds? – Castapass
inside the__init__
s) in spyder it shows the signature ofA.__init__
andB.__init__
when I printA(
orB(
. Could you add further information, such as the spyder version, the python version, a working code sample (your code produces an IndentationError) and maybe a screenshot of the incorrect suggestion? – Casta