PEP 313 - Roman numeral literals

Peter Hansen peter at engcorp.com
Tue Apr 1 14:44:01 EST 2003


Mike Meyer wrote:
> 
> Abstract
> 
>     This PEP proposes adding Roman numerals as a literal type.  It
>     also proposes the new built-in function "roman", which converts an
>     object to an integer, then converts the integer to a string that
>     is the Roman numeral literal equivalent to the integer.
> 
> Rationale
> 
>     Roman numerals are used in a number of areas, and adding them to
>     Python as literals would make computations in those areas easier.
>     For instance, Superbowls are counted with Roman numerals, and many
>     older movies have copyright dates in Roman numerals.  

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've also considered whether we should be including the roman 
alphabet in the source encodings (PEP 263) so that, for example, 
names like "MAIOR" and "IVSTINIANUS" would be properly interpreted
as "major" and "Justinians".  Unfortunately, this requires coupling
that PEP with PEP 235 (Migration to Case-Insensitive Python), and 
coupling is always a bad idea in computing.)

Oh, and a Festive Veneralia to you all. :-)

-Peter




More information about the Python-list mailing list