Re: [Pyrex] pyrex functions to replace a method (Re: replace a method in class: how?)

2006-06-29 Thread Dieter Maurer
Greg Ewing [EMAIL PROTECTED] writes on Wed, 28 Jun 2006 11:56:55 +1200: ... I have suggested that builtin functions should be given the same method-binding behaviour as interpreted functions. The idea wasn't rejected out of hand, but I don't think anything has been done about it yet. You can

Re: [Pyrex] pyrex functions to replace a method (Re: replace a method in class: how?)

2006-06-28 Thread Bruno Desthuilliers
Greg Ewing wrote: Brian Blais wrote: I have found a very similar problem trying to replace a method using a function defined in pyrex. Functions defined in Pyrex are C-implemented functions, which don't trigger the method binding magic when you access them through a class. The same

Re: [Pyrex] pyrex functions to replace a method (Re: replace a method in class: how?)

2006-06-28 Thread Brian Blais
Greg Ewing wrote: Brian Blais wrote: I have found a very similar problem trying to replace a method using a function defined in pyrex. What *should* work is to define the method inside a class in Pyrex (plain class, not extension type) and extract it out of the class's __dict__. That's

Re: [Pyrex] pyrex functions to replace a method (Re: replace a method in class: how?)

2006-06-28 Thread Stefan Behnel
Hi Brian, Brian Blais wrote: import module_py # import a function from a python module import module_pyrex # import a function from a pyrex extension module class This(object): def update1(self,val): print val def update2(self,val): print 2,val

Re: [Pyrex] pyrex functions to replace a method (Re: replace a method in class: how?)

2006-06-28 Thread Stefan Behnel
Brian Blais wrote: Greg Ewing wrote: Brian Blais wrote: I have found a very similar problem trying to replace a method using a function defined in pyrex. What *should* work is to define the method inside a class in Pyrex (plain class, not extension type) and extract it out of the

Re: [Pyrex] pyrex functions to replace a method (Re: replace a method in class: how?)

2006-06-28 Thread Lenard Lindstrom
On 28 Jun 2006 at 7:02, Brian Blais wrote: Greg Ewing wrote: Brian Blais wrote: I have found a very similar problem trying to replace a method using a function defined in pyrex. What *should* work is to define the method inside a class in Pyrex (plain class, not extension type)

Re: [Pyrex] pyrex functions to replace a method (Re: replace a method in class: how?)

2006-06-28 Thread Greg Ewing
Brian Blais wrote: TypeError: unbound method pyrex_update_within_class() must be called with update_funcs instance as first argument (got str instance instead) Hm. Okay, so that doesn't work either. But I just tried the following, and it seems to work: import new class C(str):

Re: [Pyrex] pyrex functions to replace a method (Re: replace a method in class: how?)

2006-06-27 Thread Greg Ewing
Brian Blais wrote: I have found a very similar problem trying to replace a method using a function defined in pyrex. Functions defined in Pyrex are C-implemented functions, which don't trigger the method binding magic when you access them through a class. The same thing happens if you try to