[Python-Dev] PEP for adding a decimal type to Python

Guido van Rossum guido@zope.com
Fri, 27 Jul 2001 12:57:00 -0400


Your PEP doesn't spell out what happens when a binary and a decimal
number are the input for a numerical operator.  I believe you said
that this would be an unconditional error.

But I foresee serious problems.  Most standard library modules use
numbers.  Most of the modules using numbers occasionally use a literal
(e.g. 0 or 1).  According to your PEP, literals in module files ending
with .py default to binary.  This means that almost any use of a
standard library module from your "dpython" will fail as soon as a
literal is used.

I can't believe that this will work satisfactorily.

Another example of the kind of problem your approach runs into: what
should the type of len("abc") be?  3d or 3b?  Should it depend on the
default mode?

I suppose sequence indexing has to accept decimal as well as binary
integers as indexes -- certainly in a decimal program you will want to
be able to use decimal integers for indexes.

The whole thing seems screwed.

--Guido van Rossum (home page: http://www.python.org/~guido/)