[Python-Dev] argparse ugliness

Guido van Rossum guido at python.org
Mon Mar 8 18:49:55 CET 2010

On Mon, Mar 8, 2010 at 9:17 AM, Ron Adam <rrr at ronadam.com> wrote:
> I like the strings.  They are simple and easy to use/read and they don't
> have to be created or imported before the parser is defined.

I like them too. I don't see anything unpythonic about them.

> That allows me
> to put the parser setup right after the 'if __name__ == '__main__':' so it's
> easy to find and read.  It also allows me to not import or create objects
> that may be expensive in either time or resources if I'm not going to use
> them.
> Also the strings help separate the parser from the rest of your program in a
> much cleaner way. This can make your programs more modular and easier to
> modify and maintain.

Also in this particular case a typo in the string will be caught just
about at the same time as a typo in the name would be caught.

--Guido van Rossum (python.org/~guido)

More information about the Python-Dev mailing list