Convert '165.0' to int

Gregory Ewing greg.ewing at canterbury.ac.nz
Sun Jul 24 20:04:49 EDT 2011


Frank Millman wrote:

> I know I am flogging a dead horse here, but IMHO, '165', '165.',
> '165.0', and '165.00' are all valid string representations of the
> integer 165.[1]
> 
> Therefore, for practical purposes, it would not be wrong for python's
> 'int' function to accept these without complaining.

How far would you go with that? Would you also accept
'1.65e2' as a valid representation of the integer 165?

-- 
Greg



More information about the Python-list mailing list