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