encapsulation, typing & other questions
Tim Legant
tim-dated-1013819586.fbd419 at catseye.net
Thu Feb 7 19:33:03 EST 2002
Jeff Shannon <jeff at ccvcorp.com> writes:
> (Note that Python *does* have some level of data hiding, but it's deliberately
> easy to circumvent. Instead of enforcing secrecy, it simply asks "Please don't
> look at this"... )
And quite frankly, C++, with it's strict type system and much-vaunted
data-hiding tools, can be circumvented with a couple lines of code:
#define private public
#define protected public
#include <class_whose_members_I_want_to_rape.h>
It's actually more difficult in Python, since you have to remember and
use the mangled name for each access. It all comes down to
self-discipline.
Tim
More information about the Python-list
mailing list