Will python never intend to support private, protected and public?
Thu Sep 29 10:57:07 CEST 2005
Gregor Horvath <g.horvath at gmx.at> writes:
> > If you don't want the compiler to make sure your private instance
> > variables stay private, then don't declare them that way. You're the
> > one asking for less flexibility.
> I want to declare them as private, but want to give the flexibilty to
> access them at the users own risk.
What else do you want to let users do at their own risk? Treat
integers as pointers, like in C? Both are violations of type safety.
> Declaring everything as public is nonsene, because there should be a
> garanteed stable interface.
You could have a "friend" declaration like in C++, if you want to let
some class see the private instance variables of another class.
I can't think of a single time that I've ever seen a legitimate use of
name mangling to reach from one class into another in a Python
application (I don't count something like a debugger). If you're got
some concrete examples I wouldn't mind looking.
More information about the Python-list