Annoying octal notation

Albert van der Horst albert at spenarnc.xs4all.nl
Thu Sep 3 10:36:36 EDT 2009


In article <6b5ea596-d1e3-483d-ba79-7b139d3c7a47 at z24g2000yqb.googlegroups.com>,
Bearophile  <bearophileHUGS at lycos.com> wrote:
>MRAB:
>
>>'_': 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

Also:
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
octal".

>
>-------------------------------
>
>Steven D'Aprano:
>
>> In D, at least some people want to follow Python's lead and either drop
>> support for oct literals completely, or require a 0o prefix:http://d.puremagic.com/issues/show_bug.cgi?id=2656
>
>Yes, people in the D community are trying to improve things, but it's
>a slow and painful process, and often it goes nowhere. There's lot of
>politics.

There is legacy code, of course.

>
>Bye,
>bearophile

Groetjes Albert

--
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert at spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst




More information about the Python-list mailing list