Hacker News new | ask | show | jobs
by masklinn 3569 days 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-id...

ref: https://docs.python.org/2/faq/programming.html#i-try-to-use-...

2 comments

It'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.
> Field visibility

It has nothing whatsoever to do with field visibility.

The single leading underscore?
Is conventional, it doesn't do anything at the language level.
Which 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).
Or 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.
Yes! Exactly! I added the py3 links of those in my big lengthy parent comment, so people get twice the chance to RTFM !