int/long unification hides bugs

Jeremy Fincher tweedgeezer at hotmail.com
Thu Oct 28 17:09:09 CEST 2004


kartick_vaddadi at yahoo.com (kartik) wrote in message news:<940ee3e8.0410250456.65445bbd at posting.google.com>...
> there seems to be a serious problem with allowing numbers to grow in a
> nearly unbounded manner, as int/long unification does: it hides bugs.

I think one important clarification needs to be made to this
statement: it hides bugs in code that depends on the boundedness of
integers, written before int/long unification.

The problem with int/long unification is that there is no simple
pure-Python alternative for those of us who need a bounded integer
type.  If our code depended on that raised OverflowError in order to
ensure that our computations were bounded, we're left high and dry
with ints and longs unified.  We must either drop down to C and write
a bounded integer type, or we're stuck with code that no longer works.

I'm by no means claiming that int/long unification is bad, only that
it leaves a hole in Python's toolbox where none existed before.  I
challenge anyone here to write a pure-Python class that does bounded
integer arithmetic, without basically reimplementing all of integer
arithmetic in Python.

Jeremy



More information about the Python-list mailing list