31 May
2016
31 May
'16
11:43 p.m.
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 foo.method(args) 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. However, with 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. -- Greg