Working with method-wrapper objects
Dr. Peer Griebel
griebel at konzept-is.de
Thu Apr 28 05:33:04 EDT 2005
Peer Dr. Griebel wrote:
> I think I was a little bit unspecific in my last mail.
>
> I would like to see some description about method-wrapper and
> wrapper_descriptor objects. I dont' understand the following behaviour:
>
>
>>>>type([].__str__)
>
> <type 'method-wrapper'>
>
>>>>type(object.__str__)
>
> <type 'wrapper_descriptor'>
>
>>>>type(object().__str__)
>
> <type 'method-wrapper'>
>
>>>>import inspect
>>>>inspect.isroutine([].__str__)
>
> False
>
>>>>inspect.isroutine(object.__str__)
>
> True
>
>>>>inspect.isroutine(object().__str__)
>
> False
>
> Why has [].__str__ a different type than object.__str__?
> Why is object.__str__ a routine while object().__str__ not?
>
> And one again my question: Can I extract some more information about a
> methed-wrapper object. E.g. can I somehow determine the arg spec?
>
> Thanks
> Peer
Isn't there anybody who has something to say about the issue?
I think it's not only a problem with inspect. It is aproblem about old
style classes vs. new style classes. It seems that the support for new
style classes is not complete (yet).
Some more investigation shows that also the module "types" is not
universally usable. E.g. InstanceType is only usabel for instances of
old classes. How do I test for instances of new classes?
Thanks
Peer
More information about the Python-list
mailing list