[Zope-Checkins] SVN: Zope/trunk/src/OFS/subscribers.py Optimize further by letting isinstance do the heavy lifting in C.

Tres Seaver tseaver at palladion.com
Thu Jun 24 14:25:57 EDT 2010


Log message for revision 113813:
  Optimize further by letting isinstance do the heavy lifting in C.
  
  Also makes the intent clearer.

Changed:
  U   Zope/trunk/src/OFS/subscribers.py

-=-
Modified: Zope/trunk/src/OFS/subscribers.py
===================================================================
--- Zope/trunk/src/OFS/subscribers.py	2010-06-24 18:25:21 UTC (rev 113812)
+++ Zope/trunk/src/OFS/subscribers.py	2010-06-24 18:25:57 UTC (rev 113813)
@@ -59,13 +59,8 @@
     if getattr(getattr(ob, method_name), '__five_method__', False):
         # Method knows it's deprecated
         return
-    ob_type = type(ob)
-    # Quick check for directly deprecated classes
-    if ob_type in deprecatedManageAddDeleteClasses:
+    if isinstance(ob, tuple(deprecatedManageAddDeleteClasses)):
         return
-    if any(issubclass(ob_type, cls)
-           for cls in deprecatedManageAddDeleteClasses):
-        return
     class_ = ob.__class__
     LOG.debug(
         "%s.%s.%s is discouraged. You should use event subscribers instead." %



More information about the Zope-Checkins mailing list