mixin helper class for unknown attribute access?

Alex Hunsley lard at tardis.ed.ac.molar.uk
Mon Oct 31 05:39:40 EST 2005


I know that I can catch access to unknown attributes with code something 
like the following:

class example:
      def __getattr__(self, name):
          if name == 'age':
              return __age
          else:
              raise AttributeError


but is there an existing mixin helper class in Python (or one someone 
has written) already that will assist with this? (Just not wanting to 
reinvent the wheel....)



More information about the Python-list mailing list