Feature Requests item #1518621, was opened at 2006-07-07 09:35
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1518621&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: Python Library
>Group: None
Status: Closed
Resolution: Rejected
Priority: 5
Submitted By: rhunger (rhunger)
Assigned to: Greg Ward (gward)
Summary: optparse.parse_args() ret value seems to be a dict but isn't

Initial Comment:
...
from optparse import OptionParser
parser = OptionParser()
...
(options, args) = parser.parse_args()
print options
...

options seems to be a dict but isn't. So it's not possible to use e.g.

print "Option 1: %(firstOption)s" % options

Here it's easy to use "options.firstOption" but with a larger number of program 
options it would be nice to be able to use "options" as a dict directly.

(patch attached)

----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2006-09-30 11:46

Message:
Logged In: YES 
user_id=849994

In any case, this is a feature request.

----------------------------------------------------------------------

Comment By: Greg Ward (gward)
Date: 2006-07-26 02:38

Message:
Logged In: YES 
user_id=14422

Don't believe __str__(): believe the docs.  In particular,
section 6.21.3.7 of the Python Library Reference is pretty
clear that options is not a dict.  See 
 
http://www.python.org/doc/2.4.3/lib/optparse-parsing-arguments.html

If you want a dict, no need to modify optparse: just use
vars(options).


----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-07-25 04:06

Message:
Logged In: YES 
user_id=33168

Greg, are you using the Python tracker or only optik tracker?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1518621&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to