Hi folks, A few months back I posted my first (and only) "recipe" to ActiveState. It was just a little function to convert an integer or its string representation to an ordinal value: 1 to 1st, 2 to 2nd, etc.
Not sure if this really qualifies as a recipe, per se, but it was a handy little function that I needed but couldn't find in Pythonic version elsewhere on the web (perhaps because it's so simple?). The inspiration for the function was a similar one in Django and some Java code I found online. So I figured I'd share the code once I got it working. I just noticed, however, that in the comments section of the ActiveState recipe that someone is getting incorrect results for certain numbers (11 and 12, specifically). But when I use the code on my own machine it still works fine. So I was hoping that you all could help me "crowdsource" the issue. If you have the time and inclination, could you look at the code and tell me if and where I've gone wrong? And of course, if there's a simpler way to perform the conversion I'd be glad to update the recipe. I certainly don't want something out in the wilds of the Web that's incorrect, inelegant or just plain confusing. Here's the link to the recipe: http://code.activestate.com/recipes/576888/ Your advice, as always, is appreciated. Regards, Serdar _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor