Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1dd2c82

Browse files
committed
Cosmetic fixes to make this work with Py3k (as well as with 2.5 still).
Patch by Christian Heimes.
1 parent 6398b7a commit 1dd2c82

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Doc/tools/roman.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ class InvalidRomanNumeralError(RomanError): pass
4040
def toRoman(n):
4141
"""convert integer to Roman numeral"""
4242
if not (0 < n < 5000):
43-
raise OutOfRangeError, "number out of range (must be 1..4999)"
44-
if int(n) <> n:
45-
raise NotIntegerError, "decimals can not be converted"
43+
raise OutOfRangeError("number out of range (must be 1..4999)")
44+
if int(n) != n:
45+
raise NotIntegerError("decimals can not be converted")
4646

4747
result = ""
4848
for numeral, integer in romanNumeralMap:
@@ -67,9 +67,9 @@ def toRoman(n):
6767
def fromRoman(s):
6868
"""convert Roman numeral to integer"""
6969
if not s:
70-
raise InvalidRomanNumeralError, 'Input can not be blank'
70+
raise InvalidRomanNumeralError('Input can not be blank')
7171
if not romanNumeralPattern.search(s):
72-
raise InvalidRomanNumeralError, 'Invalid Roman numeral: %s' % s
72+
raise InvalidRomanNumeralError('Invalid Roman numeral: %s' % s)
7373

7474
result = 0
7575
index = 0

0 commit comments

Comments
 (0)