PEP 318: Can't we all just get along?

Anthony Baxter anthonybaxter at gmail.com
Thu Aug 19 12:46:16 CEST 2004


On Thu, 19 Aug 2004 06:35:18 -0400, Paul Morrow <pm_mon at yahoo.com> wrote:
> Unless of course you want a method to be private/semi-private.  How do
> you feel about the way we can create/manipulate lists and dictionaries
> using special (magical) syntax?  Why is that different (acceptable)?

Look, name-mangling is horrid, and I don't think anyone's defending it. But
at the same time, "name mangling is there" is not an argument for extending
the horror to a whole new level. 

Name mangling only occurs when you create a method with two leading
underscores, and no trailing ones. Your proposal would hit _every_ _single_
'def'. It's nasty, it's unpythonic, and there's approximately _zero_ chance of
it ever going into the language. Having said that, it's perfectly feasible to do
it with a metaclass, and if you want to use it in your code, please, feel free.

Anthony



More information about the Python-list mailing list