base-class call decorator

castironpi at gmail.com castironpi at gmail.com
Wed Mar 12 07:01:54 CET 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