[IronPython] normalizing parameters from a method call

Ronnie Maor ronnie.maor at gmail.com
Thu Mar 18 18:51:56 CET 2010


will try that. thanks!

On Thu, Mar 18, 2010 at 7:49 PM, Dino Viehland <dinov at microsoft.com> wrote:

>  The code for this is in MetaPythonFunction in the FunctionBinderHelper
> class.  In particular GetArgumentsForRule is pretty close to what you’re
> wanting – but this is all working at the meta-level and creating expressions
> which will be used for the call.  But you can probably use that code as a
> base.
>
>
>
> You could also go back to an older version of Python and look for a
> KwArgBinder class which may be a little more straight forward.
>
>
>
> *From:* users-bounces at lists.ironpython.com [mailto:
> users-bounces at lists.ironpython.com] *On Behalf Of *Ronnie Maor
> *Sent:* Thursday, March 18, 2010 10:40 AM
> *To:* Discussion of IronPython
> *Subject:* [IronPython] normalizing parameters from a method call
>
>
>
> I'm writing a decorator that needs to identify whether the function it's
> wrapping contains specific variables and if so, what value was passed to
> them.
>
>
>
> For example if the function is foo(x,y) and it's called with foo(1,2)
> I want to have this information - {'x' : 1, 'y' : 2}
>
> My problem is that the caller can mix between positional and keyword
> arguments.
>
>
>
> If I write my decorator as accepting *a,**kw I can probably use
> inspect.getargspec to figure out all the information like I want it.
>
> However, it seems that this is something the language already does, so I
> wanted to know if I can get some access to the mechanism in python or
> specifically in IPy, so I don't have to write it again...
>
>
>
> Any tips would be greatly appreciated
>
>
>
> thanks
>
> Ronnie
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100318/2ed15f1b/attachment.html>


More information about the Ironpython-users mailing list