ruffyen

Untitled

Mar 20th, 2012
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. class dict(object):
  2.   def __setitem__(self, key, value):
  3.     print "Dict: Performing action of setting %r to %r" % (key, value)
  4.  
  5. class LogDict(dict):
  6.   def __setitem__(self, key, value):
  7.     print "LogDict: Logging action of setting %r to %r" % (key, value)
  8.     super(LogDict, self).__setitem__(key, value)
  9.  
  10. def main():
  11.   tmp = LogDict()
  12.   tmp.__setitem__("Key", "Value")
  13.  
  14. if __name__ == '__main__':
  15.   main()
Advertisement
Add Comment
Please, Sign In to add comment