[Python-Dev] PEP 362 implementation issue: C callables (original) (raw)

Daniel Urban urban.dani+py at gmail.com
Sat Jun 16 12:21:34 CEST 2012


On Fri, Jun 15, 2012 at 11:24 PM, Larry Hastings <larry at hastings.org> wrote:

There are four more candidates I found with the grep but couldn't figure out how to instantiate and test.  They have to do with the descriptor protocol, aka properties, but the types aren't directly exposed by Python.  They're all defined in Object/descrobject.c.  The internal class names are:

methoddescriptor classmethoddescriptor wrapperdescriptor method-wrapper (you get one of these out of a "wrapperdescriptor")

'method_descriptor' is apparently used for the methods of built-in (implemented in C) objects:

set.dict['union'].class <class 'method_descriptor'>

'classmethod_descriptor' is similarly for the classmethods of built-in classes:

import itertools itertools.chain.dict['fromiterable'].class <class 'classmethod_descriptor'>

'wrapper_descriptor' is used for example the operators of built-in types:

int.dict['add'].class <class 'wrapper_descriptor'>

And 'method-wrapper':

(5).add.class <class 'method-wrapper'>

Daniel



More information about the Python-Dev mailing list