On May 6, 6:49 am, Lie Ryan <lie.1...@gmail.com> wrote:
> Luis Zarrabeitia wrote:
> > Btw, is there any way to inject a name into a function's namespace? 
> > Following
> > the python tradition, maybe we should try to create a more general solution!
>
> How about a mechanism to pass arguments that are optional to accept?
>
> So (in the general case) the caller can call a function with certain
> arguments, but unless the function explicitly accept it, the argument
> will be discarded.
>
> With this, the injecting a local would simply be a case of adding an "I
> accept the argument" statement.
snip

You could write a decorator to do that with the inspect module, or you
could just accept a keyword dict for extra as-desired args.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to