Christian Heimes schrieb:
Thomas Heller wrote:
but this is very ugly, imo. Is there another way?
The raw_func instances that I have are not descriptors (they
do not implement a __get__() method...)
I've written PyInstanceMethod_Type for this use case. It's not (yet)
available for Python
Thomas Heller wrote:
Christian Heimes schrieb:
Thomas Heller wrote:
but this is very ugly, imo. Is there another way?
The raw_func instances that I have are not descriptors (they
do not implement a __get__() method...)
I've written PyInstanceMethod_Type for this use case. It's not (yet)
Terry Reedy schrieb:
Thomas Heller wrote:
Christian Heimes schrieb:
I've written PyInstanceMethod_Type for this use case. It's not (yet)
available for Python code. Oh, wait - there's ctypes:
Python 3.0rc1 (r30rc1:66507, Sep 18 2008, 14:47:08) [MSC v.1500 32 bit
(Intel)] on win32
Type
Thomas Heller wrote:
Ok, so one has to write an extension to access or expose it.
Oh, wait - there's ctypes:
I wrote the type to help the Pyrex and Cython developers to port their
software to 3.0. I planed to expose the type as
__builtin__.instancemethod but forgot it. Maybe we can convince
Christian Heimes schrieb:
Thomas Heller wrote:
Ok, so one has to write an extension to access or expose it.
Oh, wait - there's ctypes:
I wrote the type to help the Pyrex and Cython developers to port their
software to 3.0. I planed to expose the type as
__builtin__.instancemethod but
I'm currently using code like this to create unbound methods
from functions and stick them into classes:
method = new.instancemethod(raw_func, None, cls)
setattr(cls, name, method)
Ok, python 2.6, run with the -3 flag, gives a warning that the new
module is going away in python 3.0, so the
Thomas Heller wrote:
but this is very ugly, imo. Is there another way?
The raw_func instances that I have are not descriptors (they
do not implement a __get__() method...)
I've written PyInstanceMethod_Type for this use case. It's not (yet)
available for Python code. Barry hasn't decided
Thomas Heller a écrit :
I'm currently using code like this to create unbound methods
from functions and stick them into classes:
method = new.instancemethod(raw_func, None, cls)
setattr(cls, name, method)
setattr(cls, name, func) would work better - given that either