On May 21, 10:13 pm, George Sakkis wrote:
> On May 21, 5:55 pm, shailesh wrote:
>
> > There doesn't seem to be a predicate returning method wrappers. Is
> > there an alternate way to query an object for attributes that are of
> > method wrappers?
>
> Sure:>>> MethodWrapper = type({}.__init__)
> >
On May 21, 5:55 pm, shailesh wrote:
> There doesn't seem to be a predicate returning method wrappers. Is
> there an alternate way to query an object for attributes that are of
> method wrappers?
Sure:
>>> MethodWrapper = type({}.__init__)
>>> isinstance([].__len__, MethodWrapper)
True
But you'r
On May 20, 7:31 pm, Steven D'Aprano
wrote:
> On Wed, 20 May 2009 18:42:38 -0700, shailesh wrote:
> > The reason as far as I understand is that the methods on the built-in
> > dict are not of MethodType or FunctionType
>
> That seems to be true:
>
> >>> type({}.get)
>
>
>>> type(dict.get>
>
>
> >
On Thu, 21 May 2009 02:31:29 +, Steven D'Aprano wrote:
> So the problem isn't directly with getmembers, but with the predicate
> functions you have passed to it (inspect.isfunction and inspect.method).
> Try inspect.ismethoddescriptor instead.
Or perhaps callable ? callable({}.get) and callabl
On Wed, 20 May 2009 18:42:38 -0700, shailesh wrote:
> The reason as far as I understand is that the methods on the built-in
> dict are not of MethodType or FunctionType
That seems to be true:
>>> type({}.get)
>>> type(dict.get)
> so they are not included in
> the result of the inspect.getm
Hello,
I'm trying to write a class decorator which takes a function as an
argument and wraps instancemethods of the class with the function.
After reading a few examples on ActiveState and this blog post , my first attempt goes something like
this:
def tracing_wrapper(fn):
import functools