On 22 Aug, 10:27, David <71da...@libero.it> wrote: ... (snipped a discussion on languages and other systems interpreting numbers with a leading zero as octal)
> > Either hexadecimal should have been 0h or octal should > > have been 0t :=) > > > I have seen the use of Q/q instead in order to make it clearer. I still > prefer Smalltalk's 16rFF and 8r377. > > > Two interesting options. In a project I have on I have also considered > using 0q as indicating octal. I maybe saw it used once somewhere else > but I have no idea where. 0t was a second choice and 0c third choice > (the other letters of oct). 0o should NOT be used for obvious reasons. > > So you are saying that Smalltalk has <base in decimal>r<number> where > r is presumably for radix? That's maybe best of all. It preserves the > syntactic requirement of starting a number with a digit and seems to > have greatest flexibility. Not sure how good it looks but it's > certainly not bad. > > > > 0xff & 0x0e | 0b1101 > > 16rff & 16r0e | 2r1101 > > > Hmm. Maybe a symbol would be better than a letter. ... > > Or Ada's 16#FF#, 8#377#... > > I forget if DEC/VMS FORTRAN or Xerox Sigma FORTRAN used x'FF' or > > 'FF'x, and o'377' or '377'o ... > > What about 2_1011, 8_7621, 16_c26h or 2;1011, 8;7621, 16;c26h ? They look good - which is important. The trouble (for me) is that I want the notation for a new programming language and already use these characters. I have underscore as an optional separator for groups of digits - 123000 and 123_000 mean the same. The semicolon terminates a statement. Based on your second idea, though, maybe a colon could be used instead as in 2:1011, 8:7621, 16:c26b I don't (yet) use it as a range operator. I could also use a hash sign as although I allow hash to begin comments it cannot be preceded by anything other than whitespace so these would be usable 2#1011, 8#7621, 16#c26b I have no idea why Ada which uses the # also apparently uses it to end a number 2#1011#, 8#7621#, 16#c26b# Copying this post also to comp.lang.misc. Folks there may either be interested in the discussion or have comments to add. James -- http://mail.python.org/mailman/listinfo/python-list