Re: How to Adding Functionality to a Class by metaclass(not by inherit)

2005-08-12 Thread Paolino
Dont' know where are you going with that but if what you need is cancelling some attributes when inheriting then probably this is a cleaner approach: class Meta(type): def __init__(cls, name, bases, dic): def attributeError(*_): raise AttributeError for base in bases:

Re: How to Adding Functionality to a Class by metaclass(not by inherit)

2005-08-11 Thread Steven Bethard
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) > >

How to Adding Functionality to a Class by metaclass(not by inherit)

2005-08-11 Thread kyo guan
How to Adding Functionality to a Class by metaclass(not by inherit) #example: import inspect class Foo(object): def f(self): pass def g(self): pass class MetaFoo(type): def __init__(cls, name, bases, dic

How to Adding Functionality to a Class by metaclass(not by inherit)

2005-08-11 Thread Kyo Guan
How to Adding Functionality to a Class by metaclass(not by inherit) #example: import inspect class Foo(object): def f(self): pass def g(self): pass class MetaFoo(type): def __init__(cls, name, bases, dic