[Python-Dev] PEP 303: Extend divmod() for Multiple Divisors

Christian Tismer tismer@tismer.com
Wed, 01 Jan 2003 21:09:10 +0100


Guido van Rossum wrote:
...

>>   mm = ss//60; ss %= 60
>>
>>is very readable to me, very efficient, and doesn't use
>>extra tuples.
> 
> A good optimizing compiler could also get rid of extra tuples.

Yes. It could also figure out how to save one
division if it sees the above line instead
of divmod. But do you have it?

...

>>On dropping features, I came to this in the morning:
>>
>>You said you might optimize certain builtins by the
>>compiler, instead of removing divmod.

[proposal to replace divmod by Python code]

> But what about long division, where divmod can (in extreme cases)
> really save time by doing the division only once?

Would this case be special-cased in the interpreter
code? If not, the long divmod version would probably
not be replaced.

...

> Let's first make some steps towards the better compiler I alluded to.
> Then we can start cutting.

If this is a promise, I'm happy.
Enhancing the compiler *and* cutting code
really improves the ovrall quality.

>>This is a real wish and *no* Silvester joke :-)
> 
> 
> If only I knew what Silvester was.  Is it a German holiday celebrating
> the invention of root beer? :-)

Silvester is New Year's Eve; Hogmanay in Scotland.
We have lots of celebration, drinks, and many
fire works at midnight, to bomb the bad ghosts
away for the new year.
We also define new goals, things to do better.

One of my goals is to enhance Python while reducing its
C code base. Another one is to get the portable part
of Stackless 3.0 into the Python core.

cheers - chris

-- 
Christian Tismer             :^)   <mailto:tismer@tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/