[Python-3000-checkins] r51407 - in python/branches/p3yk/Lib: logging/__init__.py optparse.py

guido.van.rossum python-3000-checkins at python.org
Sat Aug 19 18:09:42 CEST 2006


Author: guido.van.rossum
Date: Sat Aug 19 18:09:41 2006
New Revision: 51407

Modified:
   python/branches/p3yk/Lib/logging/__init__.py
   python/branches/p3yk/Lib/optparse.py
Log:
More has_key() fixes.
The optparse fix is a fix to the previous fix, which broke has_option().


Modified: python/branches/p3yk/Lib/logging/__init__.py
==============================================================================
--- python/branches/p3yk/Lib/logging/__init__.py	(original)
+++ python/branches/p3yk/Lib/logging/__init__.py	Sat Aug 19 18:09:41 2006
@@ -806,7 +806,7 @@
         Add the specified logger as a child of this placeholder.
         """
         #if alogger not in self.loggers:
-        if not self.loggerMap.has_key(alogger):
+        if alogger not in self.loggerMap:
             #self.loggers.append(alogger)
             self.loggerMap[alogger] = None
 
@@ -863,7 +863,7 @@
         rv = None
         _acquireLock()
         try:
-            if self.loggerDict.has_key(name):
+            if name in self.loggerDict:
                 rv = self.loggerDict[name]
                 if isinstance(rv, PlaceHolder):
                     ph = rv
@@ -891,7 +891,7 @@
         rv = None
         while (i > 0) and not rv:
             substr = name[:i]
-            if not self.loggerDict.has_key(substr):
+            if substr not in self.loggerDict:
                 self.loggerDict[substr] = PlaceHolder(alogger)
             else:
                 obj = self.loggerDict[substr]

Modified: python/branches/p3yk/Lib/optparse.py
==============================================================================
--- python/branches/p3yk/Lib/optparse.py	(original)
+++ python/branches/p3yk/Lib/optparse.py	Sat Aug 19 18:09:41 2006
@@ -1040,7 +1040,7 @@
 
     def has_option(self, opt_str):
         return (opt_str in self._short_opt or
-                opt_str) in self._long_opt
+                opt_str in self._long_opt)
 
     def remove_option(self, opt_str):
         option = self._short_opt.get(opt_str)


More information about the Python-3000-checkins mailing list