[Tutor] output is all integer when there should be some floats
Jim Mooney Py3winXP
cybervigilante at gmail.com
Mon Apr 27 01:23:21 CEST 2015
On 26 April 2015 at 04:02, Steven D'Aprano <steve at pearwood.info> wrote:
> for kind in (int, float):
> try:
> return kind(astring)
>
That puzzled me for a moment until I remembered you can toss functions
around in Python. Something to play with on a Sunday afternoon ;')
But aren't most languages going in that direction? (Well, maybe not COBOL)
--
Jim
If you only had one hour left to live, would you spend it on Facebook,
Twitter, or Google Plus?
More information about the Tutor
mailing list