From: Luke Kenneth Casson Leighton Date: Mon, 29 Apr 2019 22:46:30 +0000 (+0100) Subject: add comment on _spec X-Git-Tag: ls180-24jan2020~1107 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bc7bbd60c80c44fc6d675c727938c289e2b9a631;p=ieee754fpu.git add comment on _spec --- diff --git a/src/add/stageapi.py b/src/add/stageapi.py index eb90315c..dd969ae4 100644 --- a/src/add/stageapi.py +++ b/src/add/stageapi.py @@ -80,6 +80,13 @@ import nmoperator def _spec(fn, name=None): + """ useful function that determines if "fn" has an argument "name". + if so, fn(name) is called otherwise fn() is called. + + means that ispec and ospec can be declared with *or without* + a name argument. normally it would be necessary to have + "ispec(name=None)" to achieve the same effect. + """ if name is None: return fn() varnames = dict(inspect.getmembers(fn.__code__))['co_varnames']