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 because
> Pyrex pre-wraps a function defined in a class in an
> unbound method object before putting it in the class.
> 

So I tried:

#---------------------------------------------------------------------------------

#module_pyrex.pyx

class update_funcs:

     def pyrex_update_within_class(self,val):
         print "pyrex module within class",val


#---------------------------------------------------------------------------------

#(adding to test_replace_method.py)

This.update4=module_pyrex.update_funcs.__dict__['pyrex_update_within_class']

t.update4('pyrex within class') # doesn't work

#---------------------------------------------------------------------------------

and get:

TypeError: unbound method pyrex_update_within_class() must be called with 
update_funcs instance as first argument (got str instance instead)


did I do this wrong?


                        thanks,


                                bb






-- 
-----------------

              [EMAIL PROTECTED]
              http://web.bryant.edu/~bblais
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to