I created two modules, one with
def _func():
print "hi"
and another
def func():
print "hi"
When I use the help function on the module including the first function, the help module doesn’t display this function. As opposed the second example where this function shows in the help output. Is there any functional difference aside from the use of the help function?
Yes, there is an (admittedly subtle) difference functionality-wise. Let’s assume you have a module A.py:
Observe:
The default behaviour if you do an
import *is that members with a leading underscore are not imported. You can override that behaviour by specifying an__all__list:Now:
By the way,
__all__also overrides the list of members shown byhelp()orpydoc: