[Python-3000] Minor hitch writing the Function Signature PEP

Paul Moore p.f.moore at gmail.com
Sat Apr 22 21:40:46 CEST 2006


On 4/22/06, Talin <talin at acm.org> wrote:
> Well the problem is that decorator functions don't have access to the machinery
> that binds input arguments for formal parameters. So the wrapper function has a
> hard time knowing which input arguments will be bound to which formal params,
> without having to duplicate the runtime's algorithm to do this.
>> In order to be a generic wrapper, the wrapper will have the form:
>> def wrapper( *args, **kwargs ):
> ...
>> So where is 'y' in all of that? It could be the second argument in *args; it
> could be the first argument in *args if x is passed in as a keyword argument; or
> it could be in the **kwargs dict.

[Wild idea alert!]
Maybe the signature object could have a "bind" method
 sig.bind(args, kwargs)
which returns a dictionary mapping argument names to values? In
effect, this exposes the internal mechanism for reuse.
Paul.


More information about the Python-3000 mailing list

AltStyle によって変換されたページ (->オリジナル) /