<div dir="ltr">will try that. thanks!<br><br><div class="gmail_quote">On Thu, Mar 18, 2010 at 7:49 PM, Dino Viehland <span dir="ltr"><<a href="mailto:dinov@microsoft.com">dinov@microsoft.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">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.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">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.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt">
<a href="mailto:users-bounces@lists.ironpython.com" target="_blank">users-bounces@lists.ironpython.com</a> [mailto:<a href="mailto:users-bounces@lists.ironpython.com" target="_blank">users-bounces@lists.ironpython.com</a>] <b>On
Behalf Of </b>Ronnie Maor<br>
<b>Sent:</b> Thursday, March 18, 2010 10:40 AM<br>
<b>To:</b> Discussion of IronPython<br>
<b>Subject:</b> [IronPython] normalizing parameters from a method call</span></p>
</div>
</div><div><div></div><div class="h5">
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal">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.</p>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">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}</p>
</div>
<div>
<p class="MsoNormal">My problem is that the caller can mix between positional and
keyword arguments.</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">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.</p>
</div>
<div>
<p class="MsoNormal">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...</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">Any tips would be greatly appreciated</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">thanks</p>
</div>
<div>
<p class="MsoNormal">Ronnie</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
</div>
</div></div></div>
</div>
</div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
<br></blockquote></div><br></div>