I have a question for the Python community about block comments within a Python script. I've read through PEP-8, and while a lot of the ideas and standards make sense for developing a clean module or package, I didn't see much about short Python scripts.
What I mean is, suppose I decide to make a very quick Python executable script that serves as a command line utility for running the business logic in my module.
In this command line utility, a large portion is just the setup of an argparse parser with long docstrings, followed by an entry point into the script, with a few helper functions along the way.
My style for creating this has been something like this:
############################################################
# Helper functions
############################################################
def helper1(arg):
pass # things happen
def helper2():
pass
...
############################################################
# Setup Argparse
############################################################
parser = argparse.ArgumentParser(description='Some description')
somedoc = """
Some long description for my first argument...
""".strip()
parser.add_argument('integers',
metavar='N',
type=int,
nargs='+',
help=somedoc)
parser.add_argument('otherargs',
metavar='N',
type=int,
nargs='+',
help='Some docstring')
...
############################################################
# Entry point
############################################################
if __name__ == '__main__':
args = parser.parse_args()
if len(args.integers) > 1:
helper1(args.integers)
...
Even though this isn't covered by PEP-8, I've found that this tends to be pretty readable (assuming my variable names are much better) and the block comments really help in figuring out quickly where everything is. Also, since this ends up being an executable script packaged with my application, it makes sense to keep it in one file since all it really is, is a glorified argument parser.
Is there a more Pythonic approach to this?