automatic delegation
Ville Vainio
ville at spammers.com
Tue Aug 3 06:06:59 EDT 2004
>>>>> "h.b.furuseth" == Hallvard B Furuseth <h.b.furuseth at usit.uio.no> writes:
h.b.furuseth> Is it possible to write a metaclass or something so that
h.b.furuseth> with a class definition not much larger than this:
h.b.furuseth> class foo:
h.b.furuseth> def __init__(self, val): self.val = val
h.b.furuseth> operations on a foo instance f will be applied to f.val?
h.b.furuseth> E.g. str(f) -> f.__str__() -> f.val.__str__().
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52295
--
Ville Vainio http://tinyurl.com/2prnb
More information about the Python-list
mailing list