Python is distributed as source. The very idea of a private method makes very little sense.
The programmer who wants to extend B
, frustrated by a privacy issue, looks at the source for B
, copies and pastes the source code for method
into the subclass C
.
What have you gained through "privacy"? The best you can hope for is to frustrate your potential customers into copying and pasting.
At worst, they discard your package because they can't extend it.
And yes, all open source is extended in one way or another. You can't foresee everything and every use to which you code will be put. Preventing some future use is hard to do when the code is distributed as source.
See http://stackoverflow.com/questions/261638/how-do-i-protect-python-code
Edit On "idiot-proof" code.
First, python is distributed as source 90% of the time. So, any idiot who downloads, installs, and then refuses to read the API guide and calls the methods out of order still has the source to figure out what went wrong.
We have three classes of idiots.
People who refuse to read the API guide (or skim it and ignore the relevant parts) and call the methods out of order in spite of the documentation. You can try to make something private, but it won't help because they'll do something else wrong -- and complain about it. [I won't name names, but I've worked with folks who seem to spend a lot of time calling the API's improperly. Also, you'll see questions like this on SO.]
You can only help them with a working code sample they can cut and paste.
People who are confused by API's and call the methods every different way you can imagine (and some you can't.) You can try to make something private, but they'll never get the API.
You can only help them by providing the working code sample; even then, they'll cut and paste it incorrectly.
People who reject your API and want to rewrite it to make it "idiot proof".
You can provide them a working code sample, but they don't like your API and will insist on rewriting it. They'll tell you that your API is crazy and they've improved on it.
You can engage these folks in an escalating arms race of "idiot-proofing". Everything you put together they take apart.
At this point, what has privacy done for you? Some people will refuse to understand it; some people are confused by it; and some people want to work around it.
How about public, and let the folks you're calling "idiots" learn from your code?