3 ms·
I don't hate leading underscores on _private_function or _class variable, in fact I think it's a great way to semantically signal intent The double underscore
by stnmtn 4y ago
I don't hate leading underscores on _private_function or _class variable, in fact I think it's a great way to semantically signal intent
The double underscore for __super_private_function doesn't make much sense to me though. I can't see a reason why this shouldn't just be a single underscore, especially when __double_underscore__ signals very important python internals
- clawlor 4y agoThe leading double underscore functions differently from a leading single underscore in this case: > Any identifier of the form __spam (at least two leading underscores, at most one trailing underscore) is textually replaced with _classname__spam, where classname is the current class name with leading underscore(s) stripped. See https://docs.python.org/3/tutorial/classes.html#private-variables https://docs.python.org/3/tutorial/classes.html#private-vari...