> But if I am understanding everyone's comments correctly, Python allows > me write my classes in such a way, that public access to my object's > internals is controlled, in the sense that Python has coding > conventions that tell all of the quite intelligent, respectful, > consenting adults that might use my code how I intend that code to be > used.
Yes, pretty much. Another one of those things that distinguish Python is the lack of "visibility" declarations to protect the internals of an implementation from outside forces. In many other languages, we'd use keywords like "public" or "private" or "protected" to label a variable or attribute as being accessible only by a few privileged clients. But Python has very little of this as a built-in part of the language. Guarding who gets to touch something is instead done by convention and by a very thin mechanism of name-mangling via an uncommonly-seen character, the underscore "_". For a little more discussion about this, we can see the Style Guidelines, around the part that talks about names: https://www.python.org/dev/peps/pep-0008/#descriptive-naming-styles and we'll see a bunch of recommendations about using underscores for names when we want to provide a scoping hint to others. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor