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

Mel mwilson at the-wire.com
Mon Aug 24 21:21:32 EDT 2009


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.

It has to be tweaked.  If the only digit you have is 0 then your numbers 
take the form

0*1 + 0*1**2 + 0*1**3 ...

and every number has an infinitely long representation.  If you cheat and 
take a 1 digit instead then it becomes workable.

	Mel.






More information about the Python-list mailing list