base-class call decorator

castironpi at gmail.com castironpi at gmail.com
Wed Mar 12 02:01:54 EDT 2008


If you had this,

class KType( BaseType ):
   def __init__( self, *ar, **kwar ):
      self.setProp= True
      BaseType.__init__( self, *ar, **kwar )

a lot, and wanted a decorator, what would it be?  What are the pros
and cons?

class KType( BaseType ):
   @basecall
   def __init__( self ):
      self.setProp= True

What about calling first vs. last, base class order, certain bases,
etc.?  When is it easier to do without?



More information about the Python-list mailing list