Actually, for such a function it would be irregular, because "officially" there are no private or protected fields / properties in Python.
While it makes sense to drop module attributes with leading underscores (which are usually implementation details) during import * from some module *, this is not useful in the context of any other object.
So, if you need to list only the "public" methods / attributes of the object, just go to the dir result and discard the names with leading underscores.
* "during import * from some module"
This is usually not the best practice. Consider the following example:
module A has a1 and a2 defined
module B has b1 and b2 defined
This code in module C works as expected:
from A import a1, a2 from B import *
Imagine that we add function a1 to module B Now suddenly the module C broken, although we did not touch it.
source share