[Tutor] Classes, Object and Encapsulation

Sean 'Shaleh' Perry shalehperry@attbi.com
Tue Mar 25 23:56:02 2003


>
> Finally, how do people in the "real" programming world deal with objects
> and attributes?  Do you always go to the trouble of protecting  them, or do
> you just leave them public and assume that they won't be mistreated?  I ask
> because the Python code I've seen seems NOT to take precautions with object
> attributes and just leaves them public.
>

if I am writing a module for others to use I try to clamp down as much as 
possible.  For internal classes that are just part of a project I am no where 
near as rigorous.

In the end the level of safety is dictated by the goals of the project at 
hand.

That said, there is an assumption made that people know better than to play 
with class internals or functions named _foo().