Re: no unbound methods in py3k

2008-10-09 Thread Thomas Heller
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

Re: no unbound methods in py3k

2008-10-09 Thread Terry Reedy
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)

Re: no unbound methods in py3k

2008-10-09 Thread Thomas Heller
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

Re: no unbound methods in py3k

2008-10-09 Thread Christian Heimes
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

Re: no unbound methods in py3k

2008-10-09 Thread Thomas Heller
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

no unbound methods in py3k

2008-10-08 Thread Thomas Heller
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

Re: no unbound methods in py3k

2008-10-08 Thread Christian Heimes
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

Re: no unbound methods in py3k

2008-10-08 Thread Bruno Desthuilliers
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