Rationale for core Python numeric types

Grant Edwards grante at visi.com
Thu Jul 15 15:03:21 EDT 2004


On 2004-07-15, Tim Peters <tim.peters at gmail.com> wrote:

>> If that is true, many of my data acquisition programs won't
>> work any more, because besides using the struct module, I do
>> have a need for occasional bit fiddling (masking,
>> concatenating, setting, resetting, toggling, shifting,
>> rotating) of bits in a particular word that represents some
>> register on a hardware device.
>
> You're too worried.  The only real semantic difference is that
> a left shift won't throw away bits by magic, and in a
> platform-dependent way, anymore.

How does the 1's compliment operator know how many bits to
return?  IOW, what is ~0 going to be?

For much of what I do with Python, fixed width integers would
be awfully nice -- then I wouldn't have to and everything with
0xff, 0xffff, or 0xffffffff to get the results I want.

-- 
Grant Edwards                   grante             Yow!  .. If I cover this
                                  at               entire WALL with MAZOLA,
                               visi.com            wdo I have to give my AGENT
                                                   ten per cent??



More information about the Python-list mailing list