New submission from Guilherme Polo <[EMAIL PROTECTED]>: Hi,
Doing (opts, args) = parser.parse_args(), supposing parser is an OptionParser instance, gets you an instance of class Values into opts. This patch adds the __iter__ method to the class Values so it is possible to iterate over the options you could have received. This is useful when all your options are required and you don't want to use a lot of if's to check if they are all there (for example). Right now it is possible to do this but you would have to iterate over opts.__dict__, an ugly way as I see. ---------- components: Library (Lib) files: optparse__iter__.diff keywords: patch messages: 64244 nosy: gpolo severity: normal status: open title: Adding __iter__ to class Values of module optparse versions: Python 2.6 Added file: http://bugs.python.org/file9801/optparse__iter__.diff __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2444> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com