From 17cdf2c9c1109255cbf69c7adf09760c8280ab6b Mon Sep 17 00:00:00 2001 From: Jason Michalski Date: Fri, 8 Jun 2007 00:48:21 +0000 Subject: [PATCH] python 2.4 compatabile fixes #14 --- Config.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Config.py b/Config.py index 97bcb33..f5a7564 100644 --- a/Config.py +++ b/Config.py @@ -49,7 +49,13 @@ def getValidHeights(): # Return the number in list that is nearest to x # if two values are equidistant, return the larger def nearest(x, list): - return reduce(lambda a, b: a if abs(x-a) < abs(x-b) or (abs(x-a) == abs(x-b)and a>b) else b, list) + return reduce(lambda a, b: closest(x,a,b), list) + +def closest(x,a, b): + if abs(x-a) < abs(x-b) or (abs(x-a) == abs(x-b)and a>b): + return a + else: + return b def nearestTivoWidth(width): return nearest(width, getValidWidths()) -- 2.11.4.GIT