Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class dict(object):
- def __setitem__(self, key, value):
- print "Dict: Performing action of setting %r to %r" % (key, value)
- class LogDict(dict):
- def __setitem__(self, key, value):
- print "LogDict: Logging action of setting %r to %r" % (key, value)
- super(LogDict, self).__setitem__(key, value)
- def main():
- tmp = LogDict()
- tmp.__setitem__("Key", "Value")
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment