[Python-ideas] Name mangling removal ?
jnoller at gmail.com
Sun Feb 1 13:56:17 CET 2009
On Sun, Feb 1, 2009 at 7:40 AM, Tarek Ziadé <ziade.tarek at gmail.com> wrote:
> I have found several posts of people (including Python commiters)
> asking for the removal of name mangling in Python,
> (the latest in 2006 in python-3000). I have searched in the various
> mailing lists and I can't find a clear status on this.
> If someone knows please let me know.
> Otherwise : I would like to propose this feature to be removed because
> it brakes Python philosophy imho.
This could only be done in python 3000, and without 2to3 fixers (and
smart ones at that) would break an insane amount of code.
>From a philosophically pure standpoint, I suppose this makes sense -
name mangling just doesn't make sense when we're dealing with a
language that's based on the consenting adults theory (and is can
still be bypassed).
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.
I think if you find enough support, a PEP would need to be written up
for this - it's a large enough change that we could not make it
lightly. Not to mention if done in a 3.1 or 3.2 it would break
compatibility with the older 3.xx releases (ergo, we'd need
deprecation warnings and so on).
Ultimately, I'm +1 on this but I'm wary of it too - it's a pretty big
change and without some ability to lock down/hide a given
method/variable or way of constructing "public interfaces" I think
people in the community may be upset.
Now, removing the name mangling but adding some way of declaring an
interface into a module might be nice ;)
More information about the Python-ideas