How do I "lock" an object in Python?
Say I have:
class Foo:
  def __init__(self):
    self.bar = []
    self.qnx = 10
I'd modify foo as much as I want:
foo = Foo()
foo.bar.append('blah')
foo.qnx = 20
But then I'd like to be able to "lock" it such that when I try
lock(foo)
foo.bar.append('blah')  # raises some exception.
foo.qnx = 20            # raises some exception.
Is that possible in Python?
 
    