[Checkins] SVN: Zope/branches/2.12/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:21 EDT 2010


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

Changed:
  U   Zope/branches/2.12/src/OFS/subscribers.py

-=-
Modified: Zope/branches/2.12/src/OFS/subscribers.py
===================================================================
--- Zope/branches/2.12/src/OFS/subscribers.py	2010-06-24 18:22:15 UTC (rev 113811)
+++ Zope/branches/2.12/src/OFS/subscribers.py	2010-06-24 18:25:21 UTC (rev 113812)
@@ -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 checkins mailing list