On Nov 12, 8:32 pm, Flavio <[EMAIL PROTECTED]> wrote:
> How is this code going to look like in Python 3.0? (it's deprecated
> according tohttp://docs.python.org/library/new.html#module-new, but
> it does not tell what to use instead)
>
>  method = new.instancemethod(raw_func, None, cls)
>  setattr(cls, name, method)
>
> Can we write code in python2.5/2.6 that will work in 3.0?

I'm not sure why your example works: instancemethod is
used internally to wrap the function object when it's
invoked. The only other use for it
is to add a method to an instance, not
to a class. As another poster said, an instance method
in a class is simply the function object. Static and
class methods require wrappers, but those are both
built-in functions and they also have decorators.

John Roth
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to