What do you mean by “mislead others”?
Do you mean that you might write a function called “print_list”, and
people will think it prints the list, but it actually sorts it instead?
The solution to that is to not give functions misleading names. If the
names describe what the function does, and they have good documentation
in their docstring, then they won’t mislead others.
I think I asked before if you mean something like “private” methods in
Java, but I haven’t seen an answer. If that is what you mean, the way to
do that in Python is to give your functions a name starting with a
leading underscore. Now everyone will know that it is a private function
not to be used.
The same applies to classes and modules.
And if they still use it? Okay, so what? Why do you care?
There is no way in Python to prevent a function from being called by
another module. If the other module can get access to the first module,
it can call anything it likes.
Python is not a language designed for people who think of their users as
the enemy. You don’t have to protect me from breaking things. I can
import a module and totally destroy it if I want to:
import math
math.sin = "surprise!"
del math.sqrt, math.cos, math.factorial
math.something_new = lambda x: x + 2
math.nan = 2.5
math.exp = math.tan
math.tan = math.atan
del math.atan
math.ceil, math.floor = math.floor, math.ceil
math.erf = 99.1
There you go – I have broken the math module. The only person I have
hurt by doing that is me.
To fix it, all I need to do is exit the interpreter and start it again,
and the math module is back to normal.
I think you are worrying too much about protecting against things that
aren’t problems. If I want to break the module, and make it unusable,
it’s not your job to stop me.