Author: guido.van.rossum
Date: Sat Aug 25 16:55:35 2007
New Revision: 57463
Modified:
python/branches/py3k/Doc/tools/roman.py
Log:
Cosmetic fixes to make this work with Py3k (as well as with 2.5 still).
Patch by Christian Heimes.
Modified: python/branches/py3k/Doc/tools/roman.py
==============================================================================
--- python/branches/py3k/Doc/tools/roman.py (original)
+++ python/branches/py3k/Doc/tools/roman.py Sat Aug 25 16:55:35 2007
@@ -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
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins