Convert '165.0' to int

Ben Finney ben+python at benfinney.id.au
Sun Jul 24 11:25:07 CEST 2011


Frank Millman <frank at chagford.com> writes:

> On Jul 24, 10:53 am, Ben Finney <ben+pyt... at benfinney.id.au> wrote:
> > Frank Millman <fr... at chagford.com> writes:
> > > 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]
> >
> > I disagree entirely. Once you introduce a decimal point into the
> > representation, you're no longer representing an integer.
> >
> > (They might be the same *number*, but that's not saying the same
> > thing.)
>
> Fair enough. I never did CS101

Nor I.

> so I am looking at this from a layman's perspective. I am happy to be
> corrected.

The correction I would ask to apply is: If you're to practice
programming, you can't expect the necessary fuzziness of a layman's
understanding to be sufficient in specifying your program.

You need to know the specifics of what it is you're asking the computer
to do, and what it is you're *not* asking the computer to do, and the
difference between the two.

-- 
 \           “It ain't so much the things we don't know that get us in |
  `\    trouble. It's the things we know that ain't so.” —Artemus Ward |
_o__)                                     (1834–1867), U.S. journalist |
Ben Finney



More information about the Python-list mailing list