I have some code that looks like this:
from pyparsing import Word, alphas, Optional, ...
# Do stuff ...
# And at the end, save a result to the outside world.
parser = ...
# Now use parser but don't use anything else from pyparsing again.
I like having the convenience of calling from <package> import <etc>, but I only want it to be used in a very small segment of code. I am afraid I am contributing to namespace pollution because I have a number of small snippets like this in the same file.
What is the Pythonic way of handling this situation? I am still just kind of playing around with it, so I would rather not write and rewritepyparsing. so many times.
One easy way is to use function scope to control import visibility within a file: