[Python-Dev] PEP 303: Extend divmod() for Multiple Divisors
Christian Tismer
tismer@tismer.com
Wed, 01 Jan 2003 10:00:31 +0100
Guido van Rossum wrote:
...
>>Vice versa, if at all, I suggest a built in /% operator
>>as a faster equivalen to single / and %, but I believe
>>this code can be used more efficiently.
>>divmod should be a special case of an algebraic
>>extension module and removed from the builtins.
>
>
> That would have to be //% to be in line with the // operator, of
> course. But I'd rather spend the effort towards making the compiler
> smart enough to recognize that divmod is a built-in so it can generate
> more efficient code (and I *am* prepared to make the necessary --
> slight -- changes to the language so that the compiler can make this
> deduction safely).
I stand corrected. And yes, catching certain builtins
sounds like an optimzation path that is still open.
Hey, len would have an incredible boost!!!
>>divmod does not save computation time, does not
>>reduce programming time, does not simplify programs,
>>eats paper and code space
>
>
> I find
>
> mm, ss = divmod(ss, 60)
>
> easier to read than
>
> mm, ss = ss//60, ss%60
Sure it is.
Until Silvester night, I even had no idea that divmod
is so drastically slower. Hee hee.
Which gave me a nice chance to start a whole rant
towards shrinking the language, which I found
an attractive new way to shake you up.
Don't take it too serious :-))
I-wish-you-a-divmod-ly-new-2003-and-all-the-best -- 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/