[pypy-svn] rev 1023 - pypy/trunk/src/pypy/objspace/std

arigo at codespeak.net arigo at codespeak.net
Tue Jun 24 11:27:40 CEST 2003


Author: arigo
Date: Tue Jun 24 11:27:40 2003
New Revision: 1023

Modified:
   pypy/trunk/src/pypy/objspace/std/multimethod.py
Log:
Speed trick.


Modified: pypy/trunk/src/pypy/objspace/std/multimethod.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/multimethod.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/multimethod.py	Tue Jun 24 11:27:40 2003
@@ -28,15 +28,8 @@
 
 # for dispatching use the result of this function instead of directly
 # using .__class__
+dispatchtype = lambda obj: getattr(obj, 'dispatchtype', obj.__class__)
 
-def dispatchtype(obj):
-    try:
-        return obj.dispatchtype
-    except AttributeError:
-        return obj.__class__
-
-##def todispatchtype(cls):
-##    return getattr(cls,'dispatchtype',cls)
 
 class AbstractMultiMethod(object):
     """Abstract base class for MultiMethod and UnboundMultiMethod


More information about the Pypy-commit mailing list