A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2010-March/098314.html below:

[Python-Dev] argparse ugliness

[Python-Dev] argparse ugliness [Python-Dev] argparse uglinessGreg Ewing greg.ewing at canterbury.ac.nz
Mon Mar 8 22:46:56 CET 2010
Xavier Morel wrote:
> So you'd have to write
> add_argument('--plot', action=actions.store_true) which is straight from
> the department of redundant redundancies.

This could easily be fixed with

   from argparse.actions import store_true

> An option would be 
> 
>   parser.add(actions.StoreTrue('--plot'))
> 
> but I'm not sure this makes any sense API-wise, and it would probably make
> the code a lot messier as the parser would have to reach into the action
> to get the information it needs.

It would make more sense if the object concerned were called
an Option or some such instead of an Action:

   parser.add(options.Bool('--plot'))

-- 
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4