automatic delegation

Hallvard B Furuseth h.b.furuseth at usit.uio.no
Tue Aug 3 05:29:34 EDT 2004


Is it possible to write a metaclass or something so that
with a class definition not much larger than this:

   class foo:
      def __init__(self, val): self.val = val

operations on a foo instance f will be applied to f.val?
E.g. str(f) -> f.__str__() -> f.val.__str__().

-- 
Hallvard



More information about the Python-list mailing list