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

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Nov 25 22:43:27 CET 2007

Christian Heimes wrote:
> class Example:
>    pass
> Example.id = new.instancemethod(id, None, Example)

This needs consideration. Pyrex currently makes use of
this behaviour when defining a Python class having Pyrex
functions as methods.

However, a better solution for Pyrex would be to add
method-binding behaviour to the C function object, so
that C functions can be used directly as methods. The
above example would then work simply by doing

   Example.id = id


More information about the Python-3000 mailing list