Annoying octal notation
python at mrabarnett.plus.com
Thu Sep 3 16:39:27 CEST 2009
Albert van der Horst wrote:
> In article <6b5ea596-d1e3-483d-ba79-7b139d3c7a47 at z24g2000yqb.googlegroups.com>,
> Bearophile <bearophileHUGS at lycos.com> wrote:
>>> '_': what if in the future we want to allow them in numbers for clarity?
>> Hettinger says it's hard (= requires too many changes) to do that and
>> Python programs don't have big integer constants often enough, so
>> probably that improvement will not see the light.
>> In the meantime in a Python program of mine I have put a small bug,
>> writing 1000000 instead of 10000000. Now in Python I write
>> 10*1000*1000, because I try to learn from my bugs. In D I enjoy
>> writing 10_000_000.
> Forth is one of the few language that could accept
> 10,000,000 easily (Because numbers or any token is required too be
> separated by whitespace). I have added that to my ciforth.
> Especially useful doing number theoretic things and large pointers
> in a 64 bit language it is pleasant to have a separator like that.
> Even 32 bit : 0008,0000,0050,4CE0
> In Forth you can add interpreting words, so you can add a facility CD :
> CD C:/prog/forth
> that does a directory change.
> If this has been loaded it is natural to use 0CD to
> prevent the CD word from kicking in (definitions
> trump numbers in Forth.) Before you know it, you're in
> the habit of prefixing all hex numbers by 0 if they don't
> start with a decimal digit:
> 0DEAD 0BEEF
> So for me there is nothing natural about "leading zero means
In Modula-2, a hexadecimal literal starts with a digit and ends with
"H", for example: 0FFH. Using a leading zero to indicate a certain
base doesn't seem natural to me either.
More information about the Python-list