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/2002-February/019985.html below:

[Python-Dev] a different approach to argument parsing

[Python-Dev] a different approach to argument parsing [Python-Dev] a different approach to argument parsingPaul Prescod paul@prescod.net
Tue, 12 Feb 2002 02:23:47 -0800
I like the general direction but one thing makes me a little confused...

Russ Cox wrote:
> 
>...
> 
>    for o in opt:
>         if o=='-n' or o=='--num':
>                 ncopies = opt.optarg(opt.needtype(int))

How does "opt" know that I am looking for the arguments to the --num
command line argument and not the --file one? I guess I would expect an
interface more like:

for o, value in opt:
    if o=='-n' or o=='--num':
         ncopies = optparser.needtype(value, 'integer')

 Paul Prescod



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