Any code can use and even change any attribute in any object. Numeric.exp to make sqrt behave like exp . Obviously this is not a good idea, but Python does not try to protect you against your own stupidity. Of course there is a certain chance of accidentally changing an attribute, but in practice this is not a problem. Its world view consists of nothing but objects, names, and name spaces.
All data is kept in objects, but modules, functions, classes, and methods are also objects.
Objects can be assigned to names, and names reside in name spaces. Every object has an associated name space for its attributes. There are a few rules that decide in which name space a certain name resides. Definitions in modules end up in the attribute name space of the module object. Definitions in classes go to the attribute name space of the class.