A funnily inconsistent behavior of int and float

Colin J. Williams fn681 at ncf.ca
Sun Apr 6 17:03:55 EDT 2008


Grant Edwards wrote:
> On 2008-04-06, Lie <Lie.1296 at gmail.com> wrote:
> 
>> I've noticed some oddly inconsistent behavior with int and float:
>>
>> Python 2.5.1 (r251:54863, Mar  7 2008, 03:39:23)
>> [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
>>>>> int('-          345')
>> -345
>>
>> works,
> 
> IMO, it oughtn't.

Agreed it seems inconsistent with the 
integer literal syntax
Python 2.5 Docs: 2.4.4 Integer and long 
integer literals
Python 3.0 doesn't appear to spell out 
the literal syntax.
It would be helpful if it did.

Colin W.

[snip]



More information about the Python-list mailing list