Know if a object member is a method
lucafbb at gmail.com
Mon Sep 1 14:42:26 CEST 2008
On Mon, Sep 1, 2008 at 2:18 PM, Steven D'Aprano
<steve at remove-this-cybersource.com.au> wrote:
> If your aim is to write something like a debugger, profiler, or some
> other application that needs to inspect arbitrary objects and work out
> what they do, then you probably should be using:
> isinstance(obj.methodName, new.instancemethod)
> But remember that not all callable attributes are instancemethods!
> There is no one right way of doing this.
> Hope this helps.
Yes, this helps a lot. In facts I need to do something like a language parser.
More information about the Python-list