4 ms·
It's not an implementation detail, it is a deliberate, specified and documented feature of the language dedicated to namespace conflict resolutions in the conte
by masklinn 10y ago
It's not an implementation detail, it is a deliberate, specified and documented feature of the language dedicated to namespace conflict resolutions in the context of inheritance.
ref: https://docs.python.org/2/reference/expressions.html#atom-identifiers https://docs.python.org/2/reference/expressions.html#atom-id...
ref: https://docs.python.org/2/faq/programming.html#i-try-to-use-spam-and-i-get-an-error-about-someclassname-spam https://docs.python.org/2/faq/programming.html#i-try-to-use-...
- guyzmo 10y agoYes! Exactly! I added the py3 links of those in my big lengthy parent comment, so people get twice the chance to RTFM !
- marklgr 10y agoIt's so crude that, again, it looks like implementation details having been promoted to specs. Field visibility and name mangling done with very magic underscores just doesn't look right, to me.
- masklinn 10y ago> Field visibility It has nothing whatsoever to do with field visibility.
- marklgr 10y agoThe single leading underscore?
- masklinn 10y agoIs conventional, it doesn't do anything at the language level.
- marklgr 10y agoWhich is my point, it's still roll-your-own, with some magic when necessary. I don't want to make a fuss about it, I mean, it's great for tinkering or small projects, but I prefer when my compiler works harder for me and actually enforces what is intended (bar some runtime reflection for very special cases).
- ubernostrum 10y agoOr it's just a philosophy that you happen not to like, which doesn't make it objectively bad or wrong. There's room for people to have different tastes and preferences.