Most viewed recipes tagged "int" Code RecipesRoman numeral class with overloaded int methods (Python) 2011-04-06T14:52:06-07:00thom neale <p style="color: grey"> Python recipe 577640 by <a href="/recipes/users/4176069/">thom neale</a> (<a href="/recipes/tags/homework/">homework</a>, <a href="/recipes/tags/int/">int</a>, <a href="/recipes/tags/overloading/">overloading</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/roman/">roman</a>). </p> <p>This Roman class is a subclass of int and supports the same methods int does, but any special methods that would normally return ints are return a new instance of Roman. You can use instances of this class in math expressions and a Roman instance will be returned, for example. </p> <p>The class decorator used to achieve this was suggested by Alex Martelli '<a href="">here</a> on</p>