int/long unification hides bugs
kartik
kartick_vaddadi at yahoo.com
Tue Oct 26 23:28:57 EDT 2004
"Terry Reedy" <tjreedy at udel.edu> wrote in message news:<mailman.5480.1098763791.5135.python-list at python.org>...
> "kartik" <kartick_vaddadi at yahoo.com> wrote in message
> news:940ee3e8.0410251927.38347d92 at posting.google.com...
> > 1)catching overflow bugs in the language itself frees u from writing
> > overflow tests.
>
> It is a fundamental characteristic of counts and integers that adding 1 is
> always valid. Given that, raising an overflow exception is itself a bug,
> one that Python had and has now eliminated.
>
> If one wishes to work with residue classes mod n, +1 is also still always
> valid. It is just that (n-1) + 1 is 0 instead of n. So again, raising an
> overflow error is a bug.
i don't care what mathematical properties are satisfied; what matters
is to what extent the type system helps me in writing bug-free code
> [...]However, the limit n could be
> anything, so fixing it at, say, 2**31 - 1 is almost always useless.
i dont think so. if it catches bugs that cause numbers to increase
beyond 2**31, that's valuable.
> The use of fixed range ints is a space-time machine performance hack that
> has been costly in human thought time.
on what basis do u say that
-kartik
More information about the Python-list
mailing list