string.atoi('-')

Tim Peters tim_one at email.msn.com
Thu Apr 29 20:21:25 EDT 1999


[Jens Linge]
> With python 1.51 running on a SGI:
> >>> string.atoi('-')
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
> ValueError: invalid literal for atoi(): -
> >>>
>
> But with python 1.52 running on a SGI:
> >>> string.atoi('-')
> 0
> >>>

1.5.2 on Windows:

D:\Python>python
Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import string
>>> string.atoi('-')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ValueError: invalid literal for atoi(): -
>>>

> Does it depend on the compilation?

I'd try recompiling Python with optimization disabled and see whether that
it makes it go away.  If so, you're looking at a compiler bug.

> WHAT IS THE RULE?

Do unto others as you would have them do unto you?  Something like that.

but-so-far-as-ints-go-"-"-ain't-one-ly y'rs  - tim






More information about the Python-list mailing list