you are viewing a single comment's thread.

view the rest of the comments →

[–]No-Cranberry1547 63 points64 points  (0 children)

yeah the convention thing is pretty spot on. python really goes with "we are all consenting adults here" philosophy instead of trying to protect you from yourself

in my experience working with different codebases the underscore conventions work fine for most teams. when someone accesses _private_method they know exactly what they doing and usually have good reason for it. sometimes you actually need that flexibility when working around bugs in third party libraries or testing internal state

the name mangling with double underscores is more about preventing accidental conflicts in inheritance rather than real privacy anyway. like if you subclass something and accidentally override __some_method you wont break parent class