-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Right now the names are captured in the Signature, not the param.
X = param()
@autosig(Signature(x=X))
def fun(x) ...
But this is valid too
@autosig
def fun(y=X)
This seems inconsistent with the idea that the name is part of what makes an argument and what makes its usage consistent. Imagine pandas where the data argument is also named x X or input depending on context. That would maddening. And that can be modeled in autosig right now with signatures. But if we wanted to support name consistency in the argument-free decorator, than we could add an optional name argument to param (default being any name or business as usual
X = param(name='x')
@autosig(Signature(x=X))
def fun(x) ...
And this is no longer valid
@autosig
def fun(y=X)
There is a less known and never used form of Signature which takes pairs name, Param as var args instead of the more documented and recommended kwargs. We could drop that and let the var args be just Param objects where the name is now mandatory
sig = Signature(X)
means
Signature(x=X)
Good idea, bad idea?