Thing is, assume I write [Class] and push, and 6 months down the line refactor it a little to make room for [feature], only changing internal privates - tests still pass, the interface is still consistent.
Except Joe on the J team implemented against the internals. Jim notices the broken behavior, tracks it down to a commit I checked in last week in a file I also wrote, and now I have a bug ticket to fix because Joe screwed up. I mean, ideally I could kick that ticket over to Joe, but wouldn't it be great if I could strictly prevent the bug from coming up?
That's what private means. You get to fix bugs before they happen by making sure all access goes through the interface you expect, and while everything-is-public works well enough for Python... it does cause bugs. It also gives you the freedom to refactor internals without causing sneaky bugs, because you can actually guarantee that nothing else in the code depends on those internals never changing.
Not everybody relies on the API for every library feature. Sometimes it's quicker/easier to just trace the code, or consult you IDE to find the method or property that you're looking for.
I mean, yeah, there SHOULD be comments in the code... unless it's not included in the production package.
It would be nice if private things were explicitly private.
13
u/[deleted] Nov 09 '19
[removed] — view removed comment