[Python-ideas] Name mangling removal ?

Cesare Di Mauro cesare.dimauro at a-tono.com
Sun Feb 1 15:05:47 CET 2009


On Dom, Feb 1, 2009 14:25, Tarek Ziadé wrote:
> On Sun, Feb 1, 2009 at 1:56 PM, Jesse Noller <jnoller at gmail.com> wrote:
>> I think though - there's would be a fair amount of outcry due to this
>> from the userbase/people looking at the language. Some people simply
>> want the ability to hide things within their modules/classes/etc from
>> the external consumers - this makes sense if you approach things from
>> the JWODT (Java way of doing things), privacy of internal
>> methods/variables is "key" to a clean and stable API.
>
> That's the first thing that surprised me when I started Python, since
> I came from Delphi where private and protected attributes were a
> religion back then,

In Delphi (like many other languages, such as C++, Java, etc.) protected
members aren't really protected. You can always use class crackers to gain
full (public-like) access to them.

It's a pretty common practice, and everyone that have built components has
surely used it at least one time.

Access control can be a good thing on paper, but leaves everything on the
designer's hands. So if he makes a mistake design the class, you can be
out of business.
If you are lucky, the members are protected and you can always crack them,
but when they are private, you can only give up or rewrite the class
yourself: not a beautiful prospect. And I can assure you that it wasn't
rare having the need to access private members of some VCL component.

So, if access control can be a matter of religion, men must have the
freedom to decide whatever they want to do with classes. Like Python does.
;)

Cheers
Cesare



More information about the Python-ideas mailing list