Return to Snippet

Revision: 28994
at July 18, 2010 12:10 by silviud


Initial Code
# learning python 3rd edition
# page 528

class Delegate(object):
    def __init__(self, wrapper):
        self.wrapper = wrapper

    def __getattr__(self, attribute):
        print "working on"
        return getattr(self.wrapper, attribute)




a_list = Delegate([1,2])

a_list.append(4)
working on

Initial URL

                                

Initial Description

                                

Initial Title
python delegate (wrapper)

Initial Tags
python, design

Initial Language
Python