Numeric literals in other than base 10 - was Annoying octal notation
steve at REMOVE-THIS-cybersource.com.au
Wed Aug 26 16:58:15 CEST 2009
On Tue, 25 Aug 2009 11:45:28 -0700, Mensanator wrote:
> On Aug 25, 9:14 am, Steven D'Aprano <st... at REMOVE-THIS-
> cybersource.com.au> wrote:
>> On Mon, 24 Aug 2009 18:01:38 -0700, Mensanator wrote:
>> >> If you want your data file to have values entered in hex, or oct, or
>> >> even unary (1=one, 11=two, 111=three, 1111=four...) you can.
>> > Unary? I think you'll find that Standard Positional Number Systems
>> > are not defined for radix 1.
>> Of course not. But unary isn't a positional number system. It's a tally
>> system, like my example above shows. Roman numerals are another tally
>> system. Like Roman numerals, the disadvantages of unary are that you
>> can't represent negative numbers, zero, or fractions, and anything but
>> addition and subtraction is difficult. But if you want to use it,
>> perhaps out of a sense of sadism towards your users, it's easy:
> But without insignificant leading 0's, I fail to see the relevance of
> unary to this discussion.
It was just an example of how you can use numeric data in any format, no
matter how obscure, weird or difficult, you can use it by passing it
through an appropriate converter. You don't need compiler support for
user-supplied data, you just write your own function.
As for insignificant leading zeroes, such a thing is meaningless in a
base-1 tally system. Zero is the absence of a tally mark.
> And what would you call a tally system of
> radix 2? Certainly not binary.
"Radix" isn't the correct term, because radix doesn't apply to tally
counting systems. I'd accept "base 2", in the sense that the tally is
based on two different marks. We do something similar when we mark four
tally lines, then for five we mark a diagonal line through the previous
four. So by analogy a base-2 tally could go:
But I certainly wouldn't call it "binary", for fear of confusion with
radix-2 binary. Possibly binary-tally, for lack of a better term.
More information about the Python-list