[Python-Dev] shouldn't we be considering all pending numeric proposals together?

Skip Montanaro skip@pobox.com (Skip Montanaro)
Tue, 24 Jul 2001 16:54:54 -0500

>>>>> "Guido" == Guido van Rossum <guido@digicool.com> writes:

    >> Skip Montanaro wrote:
    >> > 
    >> > There are several active or could-be-active PEPs related to Python's numeric
    >> > behavior:
    >> > 
    >> >      S   211  pep-0211.txt  Adding A New Outer Product Operator    Wilson
    >> >      S   228  pep-0228.txt  Reworking Python's Numeric Model       Zadka
    >> >      S   237  pep-0237.txt  Unifying Long Integers and Integers    Zadka
    >> >      S   238  pep-0238.txt  Non-integer Division                   Zadka
    >> >      S   239  pep-0239.txt  Adding a Rational Type to Python       Zadka
    >> >      S   240  pep-0240.txt  Adding a Rational Literal to Python    Zadka
    >> >      S   242  pep-0242.txt  Numeric Kinds                          Dubois

    Guido> I think PEP 211 and PEP 242 don't belong in this list.  PEP 211
    Guido> doesn't affect Python's number system at all, and PEP 242
    Guido> proposes a set of storage choices, not choices in semantics.  PEP
    Guido> 242 is valid regardless of what we decide about int division.

The inclusion of PEP 211 in this message was an oversight.  I pasted this
list from another message.  I included PEP 242 on purpose however.  I think
Paul gives you a language for perhaps defining other sorts of numeric
properties besides numeric precision (which is what my reading led me to
believe it was focused on).


    Guido> But it's different the other way around: PEP 238 can easily stand
    Guido> on its own.  It addresses a problem that exists even without a
    Guido> unified numeric model.

    Guido> Conversely, if PEP 238 is unacceptable, PEP 228 also has no hope,
    Guido> and PEP 239 is much less attractive.  Since PEP 238 is the only
    Guido> one that cannot avoid breaking existing code, I want to introduce
    Guido> it as soon as I can, since the others can only be introduced
    Guido> after the full compatibility waiting period for PEP 238, at least
    Guido> two years.


    Guido> If we introduce rationals, and we redefine int division as
    Guido> returning a rational instead of a float, this will not affect the
    Guido> mathematical value.


    Guido> I am currently maintaining the PEP 238 implementation as a patch;
    Guido> I don't want to start any new branches before we've merged the
    Guido> descr-branch into the trunk.

I elided a bunch of valuable information, stuff I was previously unaware of.
The acceptability or not of PEP 238 in the broader Python community appears
to be based on people only looking back.  As far as I know most people
aren't aware of the long-term motivation.  (It may have been there in one of
Guido's or Tim's messages, but if so, I missed it.)  I certainly wasn't
aware of the motivation, and I just read the above PEPs in the past day or
two.  Connecting all that together (a "meta PEP"?)  probably belongs in PEP

Here's what I propose.  Once the descr-branch has been merged, create a new
branch, call it mouse-branch.  Add the PEP 238 and other changes there and
update PEP 228 (last change: 4 Nov 2000) to include the rationale I deleted
from Guido's message.  Then urge anyone with an interest in any of these
topics to check out the mouse from CVS and play with it.  (Just don't squish
it, that's the Python's job!)  Initially, it will just have the one change
that has stirred up such a hornet's nest.  Still, even that will be
instructive to play with, and in concert with a stronger motivation for the
change in PEP 228 (and perhaps PEP 238) should help soften the blow caused
by the change.  As I mentioned in a previous message, I think you have one
chance to make this change.  If people perceive that "hey, he's going
somewhere interesting with this stuff", I think they will be more open to
the discomfort of individual changes.

Then, once you're ready (I don't know if 2.2 is far enough out), have the
Python eat the mouse and start a rat-branch that incorporates all the
rational stuff (having never used a programming language that supported
rational numbers, I find the prospect both a bit daunting and exciting).
That branch will live for a fairly long time, probably at least until 2.4,
when the int division change is complete, at which point the Python can eat
the rat.

    Guido> Have you looked at my PEP-238 patch at all?  

Not yet.  Should it be applied to the head branch or the descr-branch?