importing a method
aleax at mail.comcast.net
Tue Nov 29 04:01:59 CET 2005
Martin Miller <ggrp1.20.martineau at dfgh.net> wrote:
> I'd like to point out to the OP that using a function's __get__ method
> this way only works with new-style classes and their instances...not
> with the example in the shown in original post.
Uh, why not?
>>> class old: pass
>>> def f(self): print self
>>> o.z = f.__get__(o, old)
<bound method old.f of <__main__.old instance at 0x53d78>>
There's a million reason to avoid using old-style classes in new code,
but it doesn't seem to me that this is one of them. What am I missing?
More information about the Python-list