Christian Heimes wrote:
> Greg Ewing wrote:
>> 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
>
> A C function binder is very easy to implement.
True, but it would probably make more sense to find a way to let Pyrex
re-use the method descriptor already used for builtin types:
>>> type(str.lower)
<type 'method_descriptor'>
Interestly, I just discovered that method descriptors for builtins don't
define im_class, im_self or im_func. I never knew that - I thought they
had the same interface as instance methods.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com