summaryrefslogtreecommitdiffstats
path: root/Doc/tools/roman.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-08-25 14:55:35 (GMT)
committerGuido van Rossum <guido@python.org>2007-08-25 14:55:35 (GMT)
commit1dd2c829927b20019d09c094cd7237c44cb235ef (patch)
tree44a46686255104afb36ecbd06e58e37fbe0cd400 /Doc/tools/roman.py
parent6398b7a351d04408fa8ce0204d78559e8d6ac98f (diff)
downloadcpython-1dd2c829927b20019d09c094cd7237c44cb235ef.zip
cpython-1dd2c829927b20019d09c094cd7237c44cb235ef.tar.gz
cpython-1dd2c829927b20019d09c094cd7237c44cb235ef.tar.bz2
Cosmetic fixes to make this work with Py3k (as well as with 2.5 still).
Patch by Christian Heimes.
Diffstat (limited to 'Doc/tools/roman.py')
-rw-r--r--Doc/tools/roman.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Doc/tools/roman.py b/Doc/tools/roman.py
index 33f6db7..89ef617 100644
--- a/Doc/tools/roman.py
+++ b/Doc/tools/roman.py
@@ -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