Michele Simionato wrote: > Roy Smith wrote: > <snip> >> That being said, you can indeed have private data in Python. Just prefix >> your variable names with two underscores (i.e. __foo), and they effectively >> become private. Yes, you can bypass this if you really want to, but then >> again, you can bypass private in C++ too. > > Wrong, _foo is a *private* name (in the sense "don't touch me!"), __foo > on the contrary is a *protected* name ("touch me, touch me, don't worry > I am protected against inheritance!"). > This is a common misconception, I made the error myself in the past.
While your wording makes sense, it's probably confusing for anyone with a C++ background, where private roughly means "only accessible within the actual class" and protected roughly means "only accessible within the class and other classes derived from it". -- http://mail.python.org/mailman/listinfo/python-list