This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: optparse should support arbitrary number of arguments
Type: enhancement Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: gward Nosy List: georg.brandl, gward, nnorwitz, riteshsarraf
Priority: normal Keywords:

Created on 2006-07-24 12:03 by riteshsarraf, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (8)
msg54853 - (view) Author: Ritesh Raj Sarraf (riteshsarraf) Date: 2006-07-24 12:03
Currently, the number of arguments an option 
can/should have, needs be defined.

This is done using "nagrs".

parser.add_option("", "--my-option", nargs=3)

The problem is that at times it isn't predictable how 
many arguments you'll be receiving.

I request the implementation of this feature in 
optparse, where the following could be possible.

parser.add_option("", "--my-option", nargs=*)

Thanks,
Ritesh
msg54854 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-07-24 12:57
Logged In: YES 
user_id=849994

I don't know of any program that uses command line switches
with a variable number of args, partly because you then
cannot distinguish between option arguments and normal
arguments.

I you still need this, you can implement a custom callback,
I think.
msg54855 - (view) Author: Ritesh Raj Sarraf (riteshsarraf) Date: 2006-07-24 13:21
Logged In: YES 
user_id=382018

Can you please go through the following link and give your 
comments ?

http://groups.google.com/group/comp.lang.python/browse_thre
ad/thread/277522927334b8d8

I feel its a valid feature request.

Ritesh
msg54856 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-07-24 13:31
Logged In: YES 
user_id=849994

I share effbot's view on that, but leaving to Greg to
decide. In any case, this is a feature request.
msg54857 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2007-03-16 06:44
Optik is maintained separately.  Please file a feature request there:  http://sourceforge.net/projects/optik
msg54858 - (view) Author: Ritesh Raj Sarraf (riteshsarraf) Date: 2007-03-16 07:37
I don't think this is the correct way of resolving a bug. You mark it as "Close" with a resolution "Invalid" when the bug was filed against "Python Library", of which optparse is one. Python ships optparse as part of its libraries.

If internally, it is a separate project, you could file one there and link to it.
But why just plain close it ?
msg54859 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2007-03-16 07:47
I encourage you to file a feature request with optik if it's important to you.

While it may not be the nicest way, it's the only way we can get anything done.  I pointed you to optik so you can file the feature request if it's important to you.  What has happened in the past is that this report would be left open forever.  That is worse.

If you think this is wrong, you can fix the problem by helping us resolve all the issues in python.  Otherwise, there's no hope of us managing it.
msg54860 - (view) Author: Ritesh Raj Sarraf (riteshsarraf) Date: 2007-03-16 09:18
Thanks for clarifying Neal.

I've filed a bug with optik, #1681933
History
Date User Action Args
2022-04-11 14:56:19adminsetgithub: 43711
2006-07-24 12:03:42riteshsarrafcreate