<build-in function> incompatible with <function>

James Stroud jstroud at ucla.edu
Mon Jan 30 21:35:53 EST 2006


Luke wrote:
> Thanks James, though from the output of b.x() it appears that x is a
> class method (ie the class is passed as the first parameter rather than
> the instance)...
> 

Sorry, the one line was probably supposed to be

b = bob()

I forgot the parens:

py> b = bob()
py> b.x = types.MethodType(doit, b)
py> b.x()
<__main__.bob instance at 0x404afb6c>
py> b.x
<bound method ?.doit of <__main__.bob instance at 0x404afb6c>>

James



More information about the Python-list mailing list