Protection levels in Python

Kay Schluehr kay.schluehr at gmx.net
Thu Jul 27 12:04:42 EDT 2006


People often ask for making attributes "private" in the sense of
restricting access as in Java or C++. I've created a recipe for
attribute protection where all attributes are basically protected in
the C++ sense of being visible in the class and in subclasses and where
"public" attributes have to be declared explicitely:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496920

Regards,
Kay




More information about the Python-list mailing list