Almost There - os.kill()

Delaney, Timothy (Tim) tdelaney at avaya.com
Mon Sep 24 08:07:20 EDT 2007


Carsten Haese wrote:

> On Mon, 2007-09-24 at 19:48 +0800, Delaney, Timothy (Tim) wrote:
>> Always be careful with int() incase any of the values have a leading
>> zero - check the documentation for int() carefully.
> 
> Why would leading zeroes be a problem?
> 
>>>> int("10")
> 10
>>>> int("010")
> 10
>>>> int("0010")
> 10
>>>> int("00010")
> 10
> 
> Maybe you're thinking of "evil eval?"
> 
>>>> eval("10")
> 10
>>>> eval("010")
> 8

Nope - pretty sure that an earlier version of Python defaulted to a
radix of 0, but it appears to default to a radix of 10 in Python 2.5.

In any case, I've submitted a bug report and suggested new text for the
documentation of int() to make it clear what happens when a radix is not
specified.

Tim Delaney



More information about the Python-list mailing list