[Python-Dev] __mangled in stdlib considered poor form (original) (raw)
Guido van Rossum gvanrossum at gmail.com
Sat Aug 28 20:50:45 CEST 2004
- Previous message: [Python-Dev] __mangled in stdlib considered poor form
- Next message: [Python-Dev] __mangled in stdlib considered poor form
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
_> I'd like to see all occurrances of mangledName in the stdlib > removed and replaced with just mangledName.
[...] > What sayeth the rest of python-dev? +1.
+0.5 here. Let's first get the terminology straight: __foo is a private name, _Class__foo is the mangled form of that. Whenever the stdlib uses a mangled name, clearly what ought to be done is change the private name to a single underscore. (I don't want to call that protected, because that has a different meaning in Java etc.)
There's one potential use case where I'd like to keep the private name even if there's a mangled use of it nearby: when the private name really is intended to be private, and the mangled use is a "friend" in the C++ sense. Sometimes (though rarely) the stdlib has to indulge in practices that aren't good example code, because it's the stdlib, and it should implement functionality in the most bulletproof way possible. Using private names for internal details is the right thing sometimes.
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] __mangled in stdlib considered poor form
- Next message: [Python-Dev] __mangled in stdlib considered poor form
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]