Will python never intend to support private, protected and public?

Gregor Horvath g.horvath at gmx.at
Wed Sep 28 17:56:28 EDT 2005


Paul Rubin schrieb:
> Gregor Horvath <g.horvath at gmx.at> writes:
> 
>>>to be able to share private variables with other classes under certain
>>>circumstances, it's better to use something like C++'s "friend"
>>>declaration, where you can export the variables to a specific other class.
>>
>>That assumes that you always know for sure that the given variable
>>will always be used as a private/friend variable in the lifecycle of
>>the software.
> 
> 
> Obviously if you find you need to use it in another place later, you
> update the declaration.  The idea is for you (or an automatic tool) to

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.

The fact that in other languages there are wired tricks to get to 
private instance variables is a strong indicator that there is a need 
for that.

Guided freedom is better than enforced authority.

--
Greg



More information about the Python-list mailing list