It would be convenient to be able to access the resultant options from optparse using the syntax options['some_option'] instead of options.some_option Or additionally it would be nice to have a way to produce a dictionary of the options. This would be nice to have to do something to the effect of dictOptions = options.to_dict() obj = SomeObject(**dictOptions)
Thanks for your report and your ideas for Python :) Some remarks: 1) New features have to target 3.2; 2.6 is the current stable version (only security and documentation fixes) and 2.7 is to be released really soon (end of the 2.x line); 2) Can you explain why options['thing'] would be more convenient than options.thing? 3) You can get a dict today with vars(options). (By the way, please open two reports for two requests in the futures.) 4) optparse is superseded by argparse, I don’t know if new features will be added to optparse.
Given that the one obvious way of using dict-style syntax given a Python object is to call vars(), I thing adding a __getitem__ is probably a bad idea.