Possible Duplicate:
Can set any property of Python object
In [67]: obj = object()    
In [68]: obj.x = 42
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/home/user/<ipython-input-68-0203a27904ca> in <module>()
----> 1 obj.x = 42
AttributeError: 'object' object has no attribute 'x'    
In [69]: class myc(object):
   ....:     pass
   ....:     
In [70]: my = myc()    
In [71]: my.x = 42
Looks like an inconsistency. How do I make my classes similar to object without allowing to add new attributes?
 
     
    