I am writing a simple Python library in which I have several "private" functions, starting with underscore:
def _a():
pass
def _b():
pass
def public_interface_call():
_a()
_b()
That way, library users can simply do it from MyLib.Module import *, and their namespace will not be cluttered with implementation details.
However, I also write unit tests in which I would like to test these functions separately and just importing really all the characters from my module would be very convenient. I am currently studying from Mylib.Module import _a _b public_interface_call, but I am wondering if there is a better / faster / cleaner way to achieve what I want?
source
share