[Python-ideas] Quick idea: defining variables from functions that take the variable name
greg.ewing at canterbury.ac.nz
Tue May 31 19:43:05 EDT 2016
Steven D'Aprano wrote:
> If you're worried that it will be confusing that we define a callable to
> take (say) three arguments ... but then call it with only two ...
> I think you're worrying over nothing.
The situation with "self" is a bit different. When you
do something like
it's obvious that something is being done *before* the
call, i.e. looking up the 'method' attribute of foo, and
that step has the opportunity to manufacture and return
a callable having the appropriate number of args.
x -> TypeVar()
it looks very much like whatever is bound to TypeVar
is being called directly, before anything else happens.
For that not to be the case would be a rather higher
order of weirdness, IMO.
More information about the Python-ideas