Leading 0's syntax error in datetime.date module (Python 3.6)

Ben Bacarisse ben.usenet at bsb.me.uk
Fri May 11 08:23:21 EDT 2018


bartc <bc at freeuk.com> writes:

> On 11/05/2018 01:25, Marko Rauhamaa wrote:
>> Chris Angelico <rosuav at gmail.com>:
>>
>>> Octal makes a lot of sense in the right contexts.
>>
>> I think octal is a historical relic from a time when people weren't yet
>> comfortable with hexadecimal.
>
> It's a relic from when machines had word sizes that were multiples of
> three bits, or were divided up on 3-bit boundaries.

It got into C via B and B was often used on machine with a word size
that was a multiple of three.  But octal was very useful on 16-bit
PDP-11s which is probably why it was kept.  The PDP-11 has 8 registers
and uses 3 bits to specify the addressing mode and many instructions use
the top bit to indicate a variation such as word or byte operation.  The
result is that you'd never choose to use hex to look at PDP-11 code.
That familiarity with octal must have played a bit part in deciding to
include it in C.

-- 
Ben.



More information about the Python-list mailing list