How to avoid overflow errors

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sat Sep 15 07:35:23 CEST 2007


On Fri, 14 Sep 2007 21:43:38 -0300, Eduardo O. Padoan wrote:

>> How do I subclass int and/or long so that my class also auto-converts
>> only when needed?
> 
> What about just subclassing long - is this not an option?

Of course it's an option. As it turned out, that was the easiest way for 
me to proceed. I was a little concerned that the overhead of using longs 
might have been excessive, but for values close to zero (and by close I 
mean < millions) there's no significant time difference between 
arithmetic with ints and longints.


-- 
Steven.



More information about the Python-list mailing list