Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #87452 > unrolled thread

Re: Odd ValueError using float

Started byChris Angelico <rosuav@gmail.com>
First post2015-03-15 09:20 +1100
Last post2015-03-15 09:20 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Odd ValueError using float Chris Angelico <rosuav@gmail.com> - 2015-03-15 09:20 +1100

#87452 — Re: Odd ValueError using float

FromChris Angelico <rosuav@gmail.com>
Date2015-03-15 09:20 +1100
SubjectRe: Odd ValueError using float
Message-ID<mailman.378.1426371627.21433.python-list@python.org>
On Sun, Mar 15, 2015 at 9:09 AM, Cameron Simpson <cs@zip.com.au> wrote:
> On 14Mar2015 08:28, Emile van Sebille <emile@fenx.com> wrote:
>>
>> It ran almost to completion before generating the error again --
>>
>> (Pdb) decval
>> '4'
>> (Pdb) type(decval)
>> <type 'str'>
>> (Pdb) len(decval)
>> 1
>> (Pdb) int(decval)
>> *** ValueError: invalid literal for int() with base 10:
>> '41.700000000000003'
>>
>> So there's still something amiss.
>
>
> Am I missing something obvious here? int() likes only ints, not floats:

Possibly missing the bit where decval looks to be a string containing
the one character U+0034 DIGIT FOUR, and then suddenly has a whole
mess of extra characters. :)

Check out the fenx stuff, as that's the only non-stdlib code you have.
Maybe it calls on a C extension module somewhere deep inside it.

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web