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.

Title: Extension to optparse: options with optional arguments
Type: enhancement Stage:
Components: Library (Lib) Versions:
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: gward Nosy List: gward, nnorwitz, pollastri
Priority: normal Keywords:

Created on 2004-11-25 14:18 by pollastri, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg54306 - (view) Author: pollastri (pollastri) Date: 2004-11-25 14:18
When parsing command line options, I found very useful
to have an
option with a facultative value, able to do the following:

1-tell to me if the option was or was not seen on the
command line, return the value None if the option was
not seen;

2-if the option only was specified, return a default value.

3-if the option with a value was specified on the
command line, return the specified value;

A way to reach this goal can be the addition of a new
value for the options actions in module optparse, it
may be something like "store_with_default".

msg54307 - (view) Author: Greg Ward (gward) (Python committer) Date: 2005-01-05 13:19
Logged In: YES 

I don't know what "facultative" means, but what you want is
optional option arguments.  Don't worry, I want that feature
too, and have even started implementing it on a branch of
the Optik source repository.  See
for a similar feature request.

I'm leaving this open, since I haven't finished anything or
merged it into the Python CVS.  It could be a few months
before there's any action here, and it certainly won't
happen before Optik 1.6 / Python 2.5.  Might require Optik
2.0, in which case I'm not certain when it'll get into Python.
msg54308 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2007-03-16 06:11
Greg, since optik is maintained separately, it seems to make sense to close this and possibly create a new report in optik. .  Let me know if that's not how you want to handle bugs/feature requests.
Date User Action Args
2022-04-11 14:56:08adminsetgithub: 41228
2004-11-25 14:18:25pollastricreate