[Python-3000] PEP 3101 suggested corrections

Jim Jewett jimjjewett at gmail.com
Sun Oct 28 18:27:57 CET 2007


On 10/26/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Jim Jewett wrote:
> > If it weren't for backwards compatibility, 'i' would be a much better
> > option,

> No, it wouldn't, because 'integer' is a data type, not
> a display format. The Python format codes specify display
> formats, not data types.

I think that distinction is splitting hairs.

(1)  Even to a programmer, there may not be much difference between

    "%f" prints it as a float
and
    "%f" means to convert it to a float and print that

(If anything, the docs support the second definition.)

(2)  To most people, all numbers are base-10, and using another base
is just a silly affectation, like pig-latin.

Decimal doesn't mean "base 10", it means "has a decimal point", and
contrasts with both fractions and integers.

Programmers have typically been exceptions, but I'm not sure how true
that will remain in the future.  Octal is already a wart that causes
more bugs that it prevents.  Hex is still useful.  In another
half-generation, I'm not so sure.

It is *probably* too early to drop support for %d as "Signed integer
decimal" rather than "Decimal".  But I believe the docs would already
be improved by changing the definition table at
http://docs.python.org/lib/typesseq-strings.html from

    d	Signed integer decimal.	
    i	Signed integer decimal.

to

    d	Signed integer decimal.  Currently an alias for i.
    i	Signed integer decimal.

-jJ


More information about the Python-3000 mailing list