Marc 'BlackJack' Rintsch wrote: > But why use a metaclass? If the meta class is only applied to *one* > class, can't you do at class level whatever the metaclass is doing!?
The very fact that you can put a loop inside __metaclass__ may be reason enough for a one-off metaclass. Here's a contrived example: class X : def __metaclass__( name, bases, dict ) : for k,v in dict.items() : if k.startswith('get_') : dict[ k[4:].upper() ] = property( v ) return type( name, bases, dict ) def get_a( self ) : ... def get_b( self ) : ... o = X() print o.A print o.B
signature.asc
Description: OpenPGP digital signature
-- http://mail.python.org/mailman/listinfo/python-list