[Python-checkins] peps: Make roman.py Python3 compatible.
serhiy.storchaka
python-checkins at python.org
Tue May 3 03:51:42 EDT 2016
https://hg.python.org/peps/rev/27148ecccb03
changeset: 6299:27148ecccb03
user: Serhiy Storchaka <storchaka at gmail.com>
date: Tue May 03 10:49:19 2016 +0300
summary:
Make roman.py Python3 compatible.
files:
roman.py | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/roman.py b/roman.py
--- a/roman.py
+++ b/roman.py
@@ -40,9 +40,9 @@
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 @@
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
--
Repository URL: https://hg.python.org/peps
More information about the Python-checkins
mailing list