[Checkins] SVN: zope.cachedescriptors/trunk/src/zope/cachedescriptors/method.txt Call me a pedant, but there's no reason to reimplement math.hypot even in

Marius Gedminas marius at pov.lt
Fri Aug 27 16:54:36 EDT 2010


Log message for revision 115973:
  Call me a pedant, but there's no reason to reimplement math.hypot even in
  examples.
  
  

Changed:
  U   zope.cachedescriptors/trunk/src/zope/cachedescriptors/method.txt

-=-
Modified: zope.cachedescriptors/trunk/src/zope/cachedescriptors/method.txt
===================================================================
--- zope.cachedescriptors/trunk/src/zope/cachedescriptors/method.txt	2010-08-27 18:11:17 UTC (rev 115972)
+++ zope.cachedescriptors/trunk/src/zope/cachedescriptors/method.txt	2010-08-27 20:54:35 UTC (rev 115973)
@@ -18,7 +18,7 @@
     ...     @method.cachedIn('_cache')
     ...     def distance(self, x, y):
     ...         print 'computing distance'
-    ...         return math.sqrt((self.x - x)**2 + (self.y - y)**2)
+    ...         return math.hypot(self.x - x, self.y - y)
     ...
     >>> point = Point(1.0, 2.0)   
 



More information about the checkins mailing list