type function does not subtype

Lenard Lindstrom nada at nowhere.xxx
Wed Mar 26 16:03:08 EST 2003


"Greg Ewing wrote
>...
> Staticmethods and classmethods don't have all those attributes,
> so they shouldn't be subclasses of function.
>...
Bad choices. But certainly instancemethod could stand to look more
function-like? You cannot 'inspect' it directly. You must inspect
meth.im_func. So inspect.getargspec(meth) would probably show parameter
'self'. This is such a defacto keyword that its usage is obvious. There are
ways to hide it in func_code.co_varnames, but would require a certain amount
of overhead.

>...
> That's not to say they don't exist, and I agree that
> there's no reason for function objects *not* to be
> subclassable. It's just that nobody's had a pressing
> enough need to subclass one yet to make it so.
>
I am not neccessarily suggesting function subtyping. That was just an
observation. What I see is an inconsistancy between real functions and all
other non-builin callables. Having some way to get 'inspect' to work with
non-function callables would probably be enough. So maybe only inspect needs
changing.

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







More information about the Python-list mailing list