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

Antoon Pardon apardon at forel.vub.ac.be
Fri Sep 30 02:50:53 EDT 2005


Op 2005-09-29, Simon Brunning schreef <simon.brunning at gmail.com>:
> On 9/29/05, could ildg <could.net at gmail.com> wrote:
>> **Encapsulation** is one of the 3 basic characteristics of OOP.
>
> Pyhton has encapsulation. On objetcts members are encapsulated in a
> namespace all of its own. You can't change these by accident.
>
>> Every programmer is  just a human being, but not God. Our life is limited,
>> our time is limited, so we need to use convenient tools to save time.
>> Private variables guarantee that we will never make stupid mistakes
>
> Private variables prevent the developer of the *client* of a class
> from making a small subset of all possible stupid mistakes. But if the
> developer of the classitself is mistaken in marking a variable as
> private, and if the language enforces this, then there is nothing at
> all that the client can do to fix it. Why should the developer of the
> class be more likely to be god-like than the user of the class? This
> has happened to me more than once.

So, talk to the devloper. The developer of the class is more god-like
because it is his development. If something goes wrong with the class
he has to find out what and that is easier if he can assure that clients
didn't mess with certain implementation details.

Sure the developer can make a mistake here, just as he can mistakes
anywhere in his code. If that happens, you should report a bug.

-- 
Antoon Pardon



More information about the Python-list mailing list