PEP 313 - Roman numeral literals

Batista, Facundo FBatista at uniFON.com.ar
Tue Apr 1 14:51:02 EST 2003


#- 
#- In addition, any calculations involving the Roman calendar 
#- (cf http://www.clubs.psu.edu/aegsa/rome/romec.html) would 
#- clearly benefit
#- from such a module.
#- 
#- My kalend.py module, currently running at 87,543 lines of code, could
#- be shrunk substantially if it could do its calculations using the
#- new roman type.  *Thank you*, Mike, for starting the process 
#- of getting 
#- this valuable feature into Python.

I think Mike is proposing a built-in function. If this is the case, I'll
like these two:

	literal IntToRoman(int)
	int RomanToInt(literal)

But if we're thinking in a module, I'll like to have an object called Roman
(or so) where I could make something like this:

	myRoman1 = Roman()
	myRoman1.fromInt(15)

	myRoman2 = Roman()
	myRoman2.fromString("X")

	myRoman3 = Roman()
	myRoman3 = myRoman1 + myRoman2

	print myRoman3.toInt()
		25

	print myRoman3.toString()
		"XXV"

A nice function in the module could be too:

	Roman.verify(literal)
		returning True if the string is a "well written" roman
number (after, if we call Roman.fromString is allright, othwerwise it will
raise an error)


I salute you.

.elm.	





More information about the Python-list mailing list