From bc7bbd60c80c44fc6d675c727938c289e2b9a631 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 29 Apr 2019 23:46:30 +0100 Subject: [PATCH] add comment on _spec --- src/add/stageapi.py | 7 +++++++ 1 file changed, 7 insertions(+) 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'] -- 2.30.2