Re: ValueError: invalid literal for int(): 1.0000000000e+00

2005-02-14 Thread Terry Reedy
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Terry Reedy wrote: >> int(somestring) without a radix argument requires that somestring be an >> decimal integer literal and nothing more and nothing else. > > but specifying a radix won't help you, though: My stateme

Re: ValueError: invalid literal for int(): 1.0000000000e+00

2005-02-14 Thread Fredrik Lundh
Terry Reedy wrote: > int(somestring) without a radix argument requires that somestring be an > decimal integer literal > and nothing more and nothing else. but specifying a radix won't help you, though: >>> int("1.0", 10) Traceback (most recent call last): File "", line 1, in ? ValueError: i

Re: ValueError: invalid literal for int(): 1.0000000000e+00

2005-02-14 Thread Terry Reedy
"Martin MOKREJ©" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] int(somestring) without a radix argument requires that somestring be an decimal integer literal and nothing more and nothing else. >>> int('1') 1 >>> int('1.0') Traceback (most recent call last): File "", line 1, in

Re: ValueError: invalid literal for int(): 1.0000000000e+00

2005-02-14 Thread Grant Edwards
On 2005-02-14, Martin MOKREJ© <[EMAIL PROTECTED]> wrote: > is this a bug or "feature" that I have to use float() to make int() > autoconvert > from it? It's a feature. Integers don't have decimal points... -- Grant Edwards grante Yow! I just had a NOSE

Re: ValueError: invalid literal for int(): 1.0000000000e+00

2005-02-14 Thread Fredrik Lundh
Martin MOKREJ© wrote: > is this a bug or "feature" that I have to use float() to make int() > autoconvert > from it? it's by design, of course. "1.00e+00" is not an integer. if you want to treat a floating point literal as an integer, you have to use an explicit conversion. --

ValueError: invalid literal for int(): 1.0000000000e+00

2005-02-14 Thread Martin MOKREJŠ
or "license" for more information. a = 1 "%5.10e" % (a) '1.00e+00' int("%5.10e" % (a)) Traceback (most recent call last): File "", line 1, in ? ValueError: invalid literal for int(): 1.00e+00 int(float("%5.10e" % (a))) 1 -- http://mail.python.org/mailman/listinfo/python-list