Integer arithmetic

Tim Roberts timr at probo.com
Wed Mar 26 02:35:55 EST 2003


Daniel Timothy Bentley <dbentley at stanford.edu> wrote:

>Am I so far off in thinking maybe this should be provided by the language?
>Some way to create an int, using some (perhaps implementation-defined)
>method of changing a long to an int?  Some way to ensure that I don't
>misguess on what themask is?

Do you realize that Python only recently ELIMINATED most of this?  Prior to
2.0, ints were ints and longs were longs and never the twain shall meet,
and most people are much happier with the quiet transition we now have.

>What if I'm programming on a machine with 36
>bit longs?  Or where 64 bits is the atomic datatype?

These kinds of concerns should, for the most part, be entirely irrelevant
to you in a language like Python.  There is so much overhead in the data
structures as it is that the bitwise representation should never enter your
head, unless you're using something like the 'struct' or 'array' modules.
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.




More information about the Python-list mailing list