Re: Will python never intend to support private, protected and public?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

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

From: Antoon Pardon <apardon@forel.vub.ac.be>
Date: Fri Sep 30 2005 - 09:11:03 CEST

Op 2005-09-29, Rocco Moretti schreef <roccomoretti@hotpop.com>:
> en.karpachov@ospaz.ru wrote:
>> On Fri, 30 Sep 2005 00:16:02 +1000
>> Steven D'Aprano wrote:
>>
>>>Say you have written a class, with a private variable. I decide that I
>>>need access to that variable, for reasons you never foresaw.
>>
>> What if the access to that variable was forbidden for reasons you never
>> foresaw? What if the class author decide to remove the variable in the next
>> version of the class, because it's not an interface, but only a part of the
>> class implementation?
>
> What if the class author removes a non-private variable or changes a
> method's documented parameters in the next version of the class, because
> he think it'll work better, or just because he can?

Changing an interface is different from changing the implementation.

A (documented) interface is like a contract. The implementation is
just one way to follow that contract.

> People who think that forbidding access to private variables/methods
> will save themselves from upgrade woes are deluding themselves.

It helps, just as locks wont save you from burglars if they really
want to rob you, but the locks do help.

-- 
Antoon Pardon
Received on Sat Oct 15 03:59:09 2005