title: transparent object versioning in python
body: <p>I'd like to version objects without them knowing it.</p>
  
  <p>Something like this:</p>
  
  <pre><code>class Versioned(object):
     ...
     def version(self):
         ...
  
  class Foo(Versioned):
  
     def __init__(self, a):
        self.a = a
  
  foo = Foo(123)
  assert foo.version() == 1
  
  foo.a = 1
  foo.a = 2
  foo.a = 3
  
  assert foo.version() == 4
  </code></pre>
  
  <p>Is there a simple way of doing this?</p>