Numeric literals in other than base 10 - was Annoying octal notation

Mensanator mensanator at aol.com
Wed Aug 26 13:58:12 EDT 2009


On Aug 26, 9:58 am, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> 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.

Ok, no problem with that.

>
> 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.

I thought the two were equivalent, but maybe I'm wrong. Anyway, that's
a minor quibble.

> 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:
>
> /     one
> X     two
> X/    three
> XX    four
> XX/   five
> XXX   six
> XXX/  seven

Sure, as long as you're consistent, there's no problem.

>
> But I certainly wouldn't call it "binary", for fear of confusion with
> radix-2 binary.

That's my point. Since the common usage of "binary" is for
Standard Positional Number System of Radix 2, it follows
that "unary" is the common usage for Standard Positional
Number System of Radix 1. That's VERY confusing since such
a system is undefined. Remember, common usage does not
necessarily properly define things. Saying simply "unary"
sounds like you're extending common usage beyond its proper
boundaries.

> Possibly binary-tally, for lack of a better term.

Then possibly unary-tally would be better than unary.
Tally systems being much less common require a less
common terminology to avoid confusion.

>
> --
> Steven




More information about the Python-list mailing list