[portland] introspecting method signatures
freyley at gmail.com
Thu Oct 23 19:51:19 CEST 2008
On Thu, Oct 23, 2008 at 4:39 AM, Jeff Rush <jeff at taupro.com> wrote:
> Jeff Schwaber wrote:
>> On Wed, Oct 22, 2008 at 2:09 PM, Jesse Hallett <hallettj at gmail.com> wrote:
>>> I found this link with code for aliasing methods. You can probably alias the
>>> original method, then override the original method name with a new method,
>>> and call the aliased method from the new method.
>>> I haven't tried the code though; so I can't guarantee that it works.
>> Yeah, I'm not sure exactly why it's working and other things I've
>> tried aren't, but that looks like what I'm trying to do.
>> Decorators, as John Hampton suggested, may also be a good choice,
>> because they're pretty clear syntax.
> Regardless of your approach, go read up about the 'inspect' module in the
> Python stdlib for tips on how to introspect the signature of a callable. It
> does all the heavy lifting that you're trying to do with the
Yep. inspect.getargspec and inspect.formatargspec are very much what I
was originally asking about.
I'll look at decorator next. =)
More information about the Portland