kyo guan wrote:
> How to Adding Functionality to a Class by metaclass(not by inherit)
> 
[snip]
>               
> class MetaFoo(type):
>       def __init__(cls, name, bases, dic):
>               super(MetaFoo, cls).__init__(name, bases, dic)
>               
>               for n, f in inspect.getmembers(Foo, inspect.ismethod):
>                       setattr(cls, n, f)
                                         ^^^^^^^^^
                                         f.im_func

See if that works.  I think it should.

But the real question is why you want to do this.  Why can't you just 
inherit from Foo?

STeVe
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to