[Python-checkins] r87999 - python/branches/py3k/Lib/cgi.py

victor.stinner python-checkins at python.org
Fri Jan 14 14:08:27 CET 2011


Author: victor.stinner
Date: Fri Jan 14 14:08:27 2011
New Revision: 87999

Log:
cgi: use isinstance(x, list) instead of type(x) == type([])

Modified:
   python/branches/py3k/Lib/cgi.py

Modified: python/branches/py3k/Lib/cgi.py
==============================================================================
--- python/branches/py3k/Lib/cgi.py	(original)
+++ python/branches/py3k/Lib/cgi.py	Fri Jan 14 14:08:27 2011
@@ -582,7 +582,7 @@
         """Dictionary style get() method, including 'value' lookup."""
         if key in self:
             value = self[key]
-            if type(value) is type([]):
+            if isinstance(value, list):
                 return [x.value for x in value]
             else:
                 return value.value
@@ -593,7 +593,7 @@
         """ Return the first value received."""
         if key in self:
             value = self[key]
-            if type(value) is type([]):
+            if isinstance(value, list):
                 return value[0].value
             else:
                 return value.value
@@ -604,7 +604,7 @@
         """ Return list of received values."""
         if key in self:
             value = self[key]
-            if type(value) is type([]):
+            if isinstance(value, list):
                 return [x.value for x in value]
             else:
                 return [value.value]


More information about the Python-checkins mailing list