Rationale for core Python numeric types
Josef Dalcolmo
dalcolmo at vh-s.de
Mon Jul 26 11:57:45 EDT 2004
on Thu, 15 Jul 2004 15:14:47 -0400
Tim Peters <tim.peters at gmail.com> wrote:
> Python longs are 2's-complement with a conceptually infinite number of
> sign bits (whether 0 or 1). So ~0 will be, like ~0L today, an
> infinite string of 1 bits. Even today:
>
> >>> (~0) & 0xff
> 255
> >>> (~0L) & 0xff
> 255L
> >>> ~0 == ~0L == -1
> True
Ok, so using longs should be the way of the future in Python, but unfortunately trying to pass to fcntl.fcntl an argument of type long fails with a message saying it can take only int's. When I define an int where the MSB (of 32 bits) is set, I get a deprecation warning. I guess the module fcntl needs some updating.
- Josef
More information about the Python-list
mailing list