Modifying signature of ctor in class
Joseph L. Casale
jcasale at activenetwerx.com
Fri Sep 25 01:01:24 CEST 2015
> py> from inspect import Signature, Parameter
> py> def foo(*args, **kwargs): pass
> py> foo.__signature__ = Signature([Parameter('x',
> Parameter.POSITIONAL_OR_KEYWORD), Parameter('y',
> py> help(foo)
> Help on function foo in module __main__:
> foo(x, *, y)
That actually should harmlessly support Python versions less than 3.3
while simply accomplishing nothing. I don't even need a test for the version.
I'll go with that as a decent trade off.
More information about the Python-list