Index: Lib/optparse.py =================================================================== --- Lib/optparse.py (revision 61179) +++ Lib/optparse.py (working copy) @@ -852,6 +852,10 @@ else: return -1 + def __iter__(self): + for key, value in self.__dict__.iteritems(): + yield key, value + def _update_careful(self, dict): """ Update the option values from an arbitrary dictionary, but only