[Python-Dev] Octal literals

Bengt Richter bokr at oz.net
Wed Feb 1 19:17:30 CET 2006

On Wed, 01 Feb 2006 09:47:34 -0800, Josiah Carlson <jcarlson at uci.edu> wrote:

>bokr at oz.net (Bengt Richter) wrote:
>> On Wed, 01 Feb 2006 12:33:36 +0000, "Gustavo J. A. M. Carneiro" <gjc at inescporto.pt> wrote:
>> [...]
>> >  Hmm.. I'm beginning to think 13r16 or 16r13 look too cryptic to the
>> >casual observer; perhaps a suffix letter is more readable, since we
>> >don't need arbitrary radix support anyway.
>[snip discussion over radix and compliments]
>I hope I'm not the only one who thinks that "simple is better than
>complex", at least when it comes to numeric constants.  Certainly it
>would be _convenient_ to express constants in a radix other than decimal,
>hexidecimal, or octal, but to me, it all looks like noise.
You don't have to use any other radix, any more than you have to use all forms
of float literals if you are happy with xx.yy. The others just become available
through a consistent methodology.

>Peronally, I was on board for the removal of octal literals, if only
>because I find _seeing_ a leading zero without something else (like the
>'x' for hexidecimal) to be difficult, and because I've found little use
>for them in my work (decimals and hex are usually all I need).
I agree that 8r641 is more easily disambiguated than 0641 ;-)

But how do you represent a negative int in hex? Or have you never encountered the need?
The failure of current formats with respect to negative values whose values you
want to specify in a bit-specifying format was my main point.

Bengt Richter

More information about the Python-Dev mailing list