[Python-3000] PEP 3101 suggested corrections

Mark Summerfield mark at qtrac.eu
Fri Oct 26 16:40:55 CEST 2007


On 2007-10-26, Guido van Rossum wrote:
> 2007/10/26, Oleg Broytmann <phd at phd.pp.ru>:
> > On Fri, Oct 26, 2007 at 09:48:28AM -0400, Chris Monson wrote:
>
> [quoting Mark Summerfield]
>
> > >         'd' - Decimal Integer. Outputs the number in base 10.
> >
> > [skip]
> >
> > >         'd' - Denary Integer. Outputs the number in base 10.
> >
> >    -1. I know what "decimal integers" are, but never heard about "denary"
> > (my spellchecker complains, too).

http://www.thefreedictionary.com/denary

> -1 indeed. What's wrong with binary, octal, decimal, hexademimal?

If it was logical it would be 'b', 'o', 'd', 'h', not 'b', 'o', 'd', 'x'.

Why use x rather than h for hexadecimal? Because it is an established
convention. Of course 'd' is an established convention too, but in the
end the C standard adopted 'i' as an alternative because people _expect_
an 'i' to be there and to mean integer. (Surely it is only old C
programmers who learnt C before 'i' was available use 'd' these days.)

And decimal may lead people new to Python to think decimal.Decimal is
intended, or at least that a decimal number (i.e., one with a fractional
part) is expected.

I think the right solution is to use

    'i' - Integer. Outputs the number in base 10.

because I think people assume base 10 for integers unless told
otherwise, whereas "decimal" is ambiguous, is it a base 10 integer or a
decimal floating point number.

Both C and C++ accept both 'i' and 'd' (and I think accepting both is
fine although that goes against TOOWTDI), but having to use 'd' somehow
seems like a retrograde step reminding me of when I started programming
in C many years ago---something I thought I'd escaped:-)

-- 
Mark Summerfield, Qtrac Ltd., www.qtrac.eu



More information about the Python-3000 mailing list