A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/1999-October/001049.html below:

[Python-Dev] getopt helper?

[Python-Dev] getopt helper?Greg Ward gward@cnri.reston.va.us
Thu, 30 Sep 1999 20:51:37 -0400
On 01 October 1999, Mark Hammond said:
> OK - general agreement.  Wheee :-)
> 
> How about this:
> 
> def getopt_or_die(opts,
>                   long_opts=[],
>                   usage=None,
>                   prog_name=None,
>                   args=None,
>                   exit_code = 1):
> 
> if usage is None, we build a very simple usage string from
> opts/long_opts.

I still think it would be very desirable to tie the short and long
options together.  Eg.

  options = [('verbose', 'v'),
             ('quiet', 'q'),
             ('thingy', None),
             (None, 'x')
             ('output=', 'o:')]
  opts, args = getopt_or_die (options, usage, ...)

Then opts would have possible keys 'verbose', 'quiet', 'thingy', 'x',
and 'value' -- never 'v', 'q', or 'o'

(Look, I restrained my tendency to invent type systems and auto-generate
help text.  There may be hope for me yet.)

        Greg



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