[Checkins] SVN: Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py pep8, avoid weird micro-optimization

Hano Schlichting cvs-admin at zope.org
Sat Apr 7 12:38:51 UTC 2012


Log message for revision 125066:
  pep8, avoid weird micro-optimization
  

Changed:
  U   Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py

-=-
Modified: Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py
===================================================================
--- Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py	2012-04-07 12:35:52 UTC (rev 125065)
+++ Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py	2012-04-07 12:38:48 UTC (rev 125066)
@@ -107,21 +107,21 @@
     def updateBrains(self):
         self.useBrains(self._v_brains)
 
-    def __getitem__(self, index, ttype=type(())):
+    def __getitem__(self, index):
         """
         Returns instances of self._v_brains, or whatever is passed
         into self.useBrains.
         """
-        if type(index) is ttype:
+        if isinstance(index, tuple):
             # then it contains a score...
             normalized_score, score, key = index
-            r=self._v_result_class(self.data[key]).__of__(aq_parent(self))
+            r = self._v_result_class(self.data[key]).__of__(aq_parent(self))
             r.data_record_id_ = key
             r.data_record_score_ = score
             r.data_record_normalized_score_ = normalized_score
         else:
             # otherwise no score, set all scores to 1
-            r=self._v_result_class(self.data[index]).__of__(aq_parent(self))
+            r = self._v_result_class(self.data[index]).__of__(aq_parent(self))
             r.data_record_id_ = index
             r.data_record_score_ = 1
             r.data_record_normalized_score_ = 1



More information about the checkins mailing list