PEP 313 - Roman numeral literals

A. Lloyd Flanagan alloydflanagan at attbi.com
Thu Apr 3 09:30:54 EST 2003


"Batista, Facundo" <FBatista at uniFON.com.ar> wrote in message news:<mailman.1049227024.16768.python-list at python.org>...
> #- 
...
> 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")
> 

FWIW, I would instead suggest Roman.from(), where the function could
handle either, such as:
def from(self, some_roman):
     try:
          self.__intval = int(some_roman)
     except ValueError:
          self.__intval = self.__stringToRoman(some_roman)
     return

So who's doing the prototype implementation? :)




More information about the Python-list mailing list