I thought that overflow errors would be a thing of the past now that 
Python automatically converts ints to longs as needed. Unfortunately, 
that is not the case.

>>> class MyInt(int):
...     pass
...
>>> MyInt(sys.maxint)
2147483647
>>> MyInt(sys.maxint+1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: long int too large to convert to int


How do I subclass int and/or long so that my class also auto-converts 
only when needed?



-- 
Steven.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to