[Python-Dev] argparse ugliness (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Wed Mar 10 13:46:14 CET 2010


Greg Ewing wrote:

Steven Bethard wrote:

Because the names are so long and you'd have to import them, I've left them as private attributes of the module, but if there's really demand, we could rename them to argparse.StoreTrueAction, etc. What's wrong with just StoreTrue?

All of this discussion about the class names is ignoring the main benefit of using the string names:

The second, explicit error is going to be more informative in most cases.

Using strings also reduces the verbosity of the code, avoiding either an "argparse." buried in the middle of the function call, or else a "from argparse import ".

Cheers, Nick.

-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia



More information about the Python-Dev mailing list