Numeric literals in other than base 10 - was Annoying octal notation
Scott David Daniels
Scott.Daniels at Acm.Org
Sun Aug 23 18:50:29 EDT 2009
James Harris wrote:...
> Another option:
>
> 0.(2:1011), 0.(8:7621), 0.(16:c26b)
>
> where the three characters "0.(" begin the sequence.
>
> Comments? Improvements?
I did a little interpreter where non-base 10 numbers
(up to base 36) were:
.7.100 == 64 (octal)
.9.100 == 100 (decimal)
.F.100 == 256 (hexadecimal)
.1.100 == 4 (binary)
.3.100 == 9 (trinary)
.Z.100 == 46656 (base 36)
Advantages:
Tokenizer can recognize chunks easily.
Not visually too confusing,
No issue of what base the base indicator is expressed in.
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list