binary representation of an integer
tjreedy at udel.edu
Tue Jun 24 21:06:35 CEST 2008
cokofreedom at gmail.com wrote:
> On Jun 24, 10:38 am, Mark Dickinson <dicki... at gmail.com> wrote:
>> Interestingly, unlike hex and oct, bin doesn't add a trailing
>> 'L' for longs:
>> I wonder whether this is a bug...
> Strange in 2.6, but I know at least in 3.0 that all integers are C
> Long's now, so the L is no longer required.
In current 2.x, the trailing L is no longer required for long integer
input; the lexer decides whether to make an int or long. Similarly,
ints are automatically converted to longs as needed instead of raising
overflow errors (as once happended). The trailing L on output would
have been removed already except for backward compatibility. But there
was no back-compatibility requirement for 0bxxxx strings.
In 3.0, all integers are class 'int'. The internal representation as
fixed or extended precision is entirely an internal implementation matter.
More information about the Python-list