[Tutor] correcting an Active State Recipe for conversion to ordinal
Sander Sweers
sander.sweers at gmail.com
Thu Feb 4 20:26:25 CET 2010
On do, 2010-02-04 at 13:30 -0500, Serdar Tumgoren wrote:
> Could you all indulge me one last time and tell me if the above
> version works for you? If so, I'll update the recipe to spare others a
> similar headache.
It now works ok but..
You should not use ord as variable as ord() is used by python already.
Also this will fail in python 3 and 2 with import from future, it does
division differently.
>>> from __future__ import division
>>> 11 % 100 / 10
1.1000000000000001
So "if value % 100/10 <> 1:" should be "if value < 10 or value > 13:".
greets
Sander
More information about the Tutor
mailing list