PEP0238 lament

Duncan Booth duncan at NOSPAMrcp.co.uk
Tue Jul 24 04:56:53 EDT 2001


Stephen Horne <steve at lurking.demon.co.uk> wrote in 
news:gmhplt4kitb3514p6kkdfg1kgl1eqr1fqg at 4ax.com:

> If you had as many cases of "£"+str(Amount/100)+"."+str(amount%100)
> and similar in your code as I do

This is an example where even today you might be better off writing 
"£%d.%02d" % divmod(Amount, 100)
especially if you ever have single digit pennies.

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list