type function does not subtype

Lenard Lindstrom nada at nowhere.xxx
Tue Mar 25 03:07:35 CET 2003

"Tim Peters" <tim_one at email.msn.com> wrote in message
news:mailman.1048478018.32024.python-list at python.org...
> [Lenard Lindstrom]
> > Would someone please explain why subtyping of type 'function' is not
> > permitted in Python 2.3?
> Nothing implemented in C is subclassable unless somebody volunteers the
> to make it subclassable; nobody volunteered the work to make the function
> type subclassable.  It sure wasn't at the top of my list <wink>.
Okay. I think I see. I notice that functions are not provided for the
tp_new, tp_init,  tp_alloc, and tp_free slots of PyFunction_Type. Just
adding  Py_TPFLAGS_BASETYPE to tp_flags will not enable subclassing for type
function. More work than I first thought. Given PEP 253 I assumed most
classes would already be converted, leaving just thoughs which would break
something if subtyping were permitted on them. Instead function was simply
neglected due to time constaints. ;-)

Lenard Lindstrom
"<%s@%s.%s>" % ("len-l.", "telus", "net")

More information about the Python-list mailing list