]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Cosmetic fixes to make this work with Py3k (as well as with 2.5 still).
authorGuido van Rossum <guido@python.org>
Sat, 25 Aug 2007 14:55:35 +0000 (14:55 +0000)
committerGuido van Rossum <guido@python.org>
Sat, 25 Aug 2007 14:55:35 +0000 (14:55 +0000)
Patch by Christian Heimes.

Doc/tools/roman.py

index 33f6db7ed3a79bc14070350bc83c138ebc221dd6..89ef617e6e71729262aa0704d025512c67ea5133 100644 (file)
@@ -40,9 +40,9 @@ romanNumeralMap = (('M',  1000),
 def toRoman(n):
     """convert integer to Roman numeral"""
     if not (0 < n < 5000):
-        raise OutOfRangeError, "number out of range (must be 1..4999)"
-    if int(n) <> n:
-        raise NotIntegerError, "decimals can not be converted"
+        raise OutOfRangeError("number out of range (must be 1..4999)")
+    if int(n) != n:
+        raise NotIntegerError("decimals can not be converted")
 
     result = ""
     for numeral, integer in romanNumeralMap:
@@ -67,9 +67,9 @@ romanNumeralPattern = re.compile("""
 def fromRoman(s):
     """convert Roman numeral to integer"""
     if not s:
-        raise InvalidRomanNumeralError, 'Input can not be blank'
+        raise InvalidRomanNumeralError('Input can not be blank')
     if not romanNumeralPattern.search(s):
-        raise InvalidRomanNumeralError, 'Invalid Roman numeral: %s' % s
+        raise InvalidRomanNumeralError('Invalid Roman numeral: %s' % s)
 
     result = 0
     index = 0