[Python-3000] Unbound methods -- keep creating API?
greg.ewing at canterbury.ac.nz
Wed Nov 28 01:35:33 CET 2007
Guido van Rossum wrote:
> Like 'len', right?
Yes, anything that's a stand-alone function rather than
a method of some C type.
> Couldn't PyRex define its own type for its functions that has a
> __get__ descriptor with the appropriate semantics?
Yes, it could, but it would be more run-time support
baggage to carry around in every Pyrex module that used
it (there's currently no mechanism for different Pyrex
modules to share runtime support code). It would be
tidier if the existing builtin function type had the
desired behaviour, that's all.
I can't imagine there would be much in the way of
existing code that would be affected by this. It would
have to be putting a builtin function into a class,
and then retrieving it via an instance and expecting
it to come back as a plain function.
But in any case, the impact on existing code could be
reduced to zero by having a flag in the method descriptor
to enable this behaviour. It would only be turned on
for functions that really need it.
More information about the Python-3000