How to avoid overflow errors
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Sat Sep 15 01:50:44 EDT 2007
On Fri, 14 Sep 2007 18:19:45 -0700, James Stroud wrote:
>> How do I subclass int and/or long so that my class also auto-converts
>> only when needed?
>>
>>
>>
>>
> Use __new__.
The disadvantage of that is that your example code requires me to
duplicate my methods in the long version and the int version. It's easy
enough to work around that (class factory function) but it just seems all
rather untidy...
--
Steven.
More information about the Python-list
mailing list