-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inspect.getargspec incompatible with kwonlyargs and function annotations #1093
Comments
Can you elaborate on PEP3107? We are really trying to use the modern python even though we have to be compatible with python 2. Does |
There are two features in python3(only) witch change the signature of a function. The python2 compatible The Looking it up, there seems to be a backport for Note that other than the python2->3 switch the 3.x updates are backward compatilbe (maybe expect some security fixes and bug as feature uses) and therefore all 3.x relases on itself have a smaller support frame (~5y), e.g. there are no updates (not even security ones) for python <=3.2 so only supporting python2 & python3.3+ (and later on 3.4+ etc.) should be fine. To elaborate on PEP3107 ;):
e.g. recurrent could be rewritten in python3: @recurrent(sequences=['inputs'], contexts=[],
states=['state], outputs=['state'])
def apply(self, inputs, state=None):
...
#given some impl. for SequenceItem,State,ParamRef
@py3recurrent
def apply(self, inputs: SequenceItem, state: State =None) -> PramRef("state"):
... But then such features are python3 only, so as long as there is python2 support, |
If
inspect.getargspec
function is used to inspect a function with with kwonlyargs or function annotations aValueError
is raised.In python3 a
inspect.getfullargspec
function exists witch could be used as a replacement but bothgetargspec
andgetfullargspec
are deprecated in python >= 3.5 so it might be the best to usesignatur()
witch nevertheless is a bit more complex.(Note that function annotations refer to PEP3107 and not to the annotation of a function...
e.g
def f(a: ParamAnnotation) -> ReturnAnnotation: pass
)Because this is only relevant for people witch really want to use such functions in a project in on of the 5 context in witch blocks uses getargspec (e.g. the recurrent annotation) I personally don't think this has a high priority for now ;)
The text was updated successfully, but these errors were encountered: