[Python-3000] Unbound methods -- keep creating API?

Guido van Rossum guido at python.org
Wed Nov 28 02:12:59 CET 2007

On Nov 27, 2007 4:35 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> 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.

Or if there were another builtin type (wrapped around a C function
obviously) with the desired behavior.

> 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.

Funny, that. I tried my patch (see previous message) and 50 unittests
had at least one failure.

> 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.

OK. I know you're not going to like this, but I'm asking that you
provide a patch yourself.

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-3000 mailing list