From a2bad4a6435c235f594050f1f241e4710c1bb755 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Sun, 07 Feb 2010 13:40:14 +0000 Subject: cleaned up comparison logic for strings --- (limited to 'talogo.py') diff --git a/talogo.py b/talogo.py index bdcaba8..6fb7a2a 100644 --- a/talogo.py +++ b/talogo.py @@ -80,30 +80,44 @@ def taequal(x, y): try: return float(x)==float(y) except: + typex, typey = False, False if type(x) == str or type(x) == unicode: - xx = ord(x[0]) + typex = True + if type(y) == str or type(y) == unicode: + typey = True + if typex and typey: + return x == y + if typex and len(x) == 1: + xx = ord(x[0]) else: xx = x - if type(y) == str or type(y) == unicode: + if typey and len(y) == 1: yy = ord(y[0]) else: yy = y return xx==yy - + def taless(x, y): try: return float(x)