[Python-checkins] r43726 - sandbox/trunk/overload/time_overloading.py

guido.van.rossum python-checkins at python.org
Sat Apr 8 00:37:47 CEST 2006


Author: guido.van.rossum
Date: Sat Apr  8 00:37:47 2006
New Revision: 43726

Modified:
   sandbox/trunk/overload/time_overloading.py
Log:
A more compact version of the accelerated code.


Modified: sandbox/trunk/overload/time_overloading.py
==============================================================================
--- sandbox/trunk/overload/time_overloading.py	(original)
+++ sandbox/trunk/overload/time_overloading.py	Sat Apr  8 00:37:47 2006
@@ -35,10 +35,7 @@
     assert False
 
 def accelerated(x, y):
-    func = automatic.cache.get((type(x), type(y)))
-    if func is not None:
-        return func(x, y)
-    return automatic(x, y)
+    return automatic.cache.get((type(x), type(y)), automatic)(x, y)
 
 # Another quick test
 assert accelerated(C(), B()) == "CB"


More information about the Python-checkins mailing list