Will python never intend to support private, protected and public?
steve at REMOVETHIScyber.com.au
Thu Sep 29 01:33:51 CEST 2005
On Wed, 28 Sep 2005 15:23:07 -0700, Paul Rubin wrote:
> Gregor Horvath <g.horvath at gmx.at> writes:
>> If its your code this is possible, but if not and the maintainer is
>> not willing or able to change it, then you have a problem.
> Perhaps the maintainer has good reason for not wanting to change it.
> After all, he's maintaining the code and you're not. In the course of
> that maintenance he might change the internal usage of the private
> variable that messes up the way you use it. He's supposed to be
> allowed to do that--that's why the variable is private. Is he
> supposed to get your permission every time he wants to change how the
> private variables in his class work?
No, but that is precisely why Python's semi-private variables are
usually better. Names like _X and class.__X are warnings to the developer
"use these at your own risk", without preventing developers who need them
from using them. You have most of the benefits of private variables with
none of the disadvantages.
More information about the Python-list