From: Jerome B. <jer...@xr...> - 2001-05-21 10:21:47
|
Hello, I attempt to make the string.atol('564645646465465L') conversion but I obtained this error trace with JPython 2.0 : merveilles{27} jpython1.1 JPython 1.1 on java1.2.2 (JIT: sunwjit) Copyright (C) 1997-1999 Corporation for National Research Initiatives >>> import string >>> string.atol('564645646465465L') Traceback (innermost last): File "<console>", line 1, in ? File "/opt/Misc/src/Python-1.5.2/Lib/string.py", line 417, in atol ValueError: non-integer argument to string.atol >>> ^D I wonder if this problem is fixed in the JPython 2.0 as it seems to be in the Python 2.0 (is an update usefull) : merveilles{22} python1.5.2 Python 1.5.2 (#31, May 26 1999, 19:10:12) [C] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import string >>> string.atol('564645646465465L') Traceback (innermost last): File "<stdin>", line 1, in ? ValueError: invalid literal for atol(): 564645646465465L >>> merveilles{20} python2.0 Python 2.0 (#4, Oct 31 2000, 14:29:17) [C] on sunos5 Type "copyright", "credits" or "license" for more information. >>> import string >>> string.atol('564645646465465L') 564645646465465L >>> Thanks, Jerome |
From: Jerome B. <jer...@xr...> - 2001-05-21 12:17:24
|
> I attempt to make the string.atol('564645646465465L') > conversion but I obtained this error trace with JPython 2.0 : > > merveilles{27} jpython1.1 > JPython 1.1 on java1.2.2 (JIT: sunwjit) Sorry, error trace with JPython 1.1 of course. Does this 'atol' problem has been fixed with JPython 2.0 ? Thanks, Jerome |
From: D-Man <ds...@ri...> - 2001-05-21 15:10:15
|
On Mon, May 21, 2001 at 02:09:41PM +0200, Jerome Bouat wrote: | > I attempt to make the string.atol('564645646465465L') | > conversion but I obtained this error trace with JPython 2.0 : | > | > merveilles{27} jpython1.1 | > JPython 1.1 on java1.2.2 (JIT: sunwjit) | | Sorry, error trace with JPython 1.1 of course. | | Does this 'atol' problem has been fixed with JPython 2.0 ? Actually, IIRC, string.atol and string.atoi are deprecated. Instead use the builtin functions "long" and "int", respectively. (unfortunately Jython doesn't have doc strings in all of the standard stuff) Python 2.1 (#1, Apr 17 2001, 09:45:01) [GCC 2.95.3-2 (cygwin special)] on cygwin_nt-4.01 Type "copyright", "credits" or "license" for more information. >>> print long.__doc__ long(x) -> long integer long(x, base) -> long integer Convert a string or number to a long integer, if possible. A floating point argument will be truncated towards zero (this does not include a string representation of a floating point number!) When converting a string, use the given base. It is an error to supply a base when converting a non-string. >>> print int.__doc__ int(x[, base]) -> integer Convert a string or number to an integer, if possible. A floating point argument will be truncated towards zero (this does not include a string representation of a floating point number!) When converting a string, use the optional base. It is an error to supply a base when converting a non-string. >>> Jython 2.0 on java1.3.0 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> print long.__doc__ None >>> print int.__doc__ None >>> long( "564645646465465L" ) 564645646465465L >>> -D |
From: Jerome B. <jer...@xr...> - 2001-05-21 15:44:55
|
Thanks, I will do as you say. I keep the problem of long('564645646465465L') with Python 1.5.2 and Jython 1.1, so I will upgrade. Jerome D-Man wrote: > > On Mon, May 21, 2001 at 02:09:41PM +0200, Jerome Bouat wrote: > | > I attempt to make the string.atol('564645646465465L') > | > conversion but I obtained this error trace with JPython 2.0 : > | > > | > merveilles{27} jpython1.1 > | > JPython 1.1 on java1.2.2 (JIT: sunwjit) > | > | Sorry, error trace with JPython 1.1 of course. > | > | Does this 'atol' problem has been fixed with JPython 2.0 ? > > Actually, IIRC, string.atol and string.atoi are deprecated. Instead > use the builtin functions "long" and "int", respectively. > > (unfortunately Jython doesn't have doc strings in all of the standard > stuff) > > Python 2.1 (#1, Apr 17 2001, 09:45:01) > [GCC 2.95.3-2 (cygwin special)] on cygwin_nt-4.01 > Type "copyright", "credits" or "license" for more information. > >>> print long.__doc__ > long(x) -> long integer > long(x, base) -> long integer > > Convert a string or number to a long integer, if possible. A floating > point argument will be truncated towards zero (this does not include a > string representation of a floating point number!) When converting a > string, use the given base. It is an error to supply a base when > converting a non-string. > >>> print int.__doc__ > int(x[, base]) -> integer > > Convert a string or number to an integer, if possible. A floating point > argument will be truncated towards zero (this does not include a string > representation of a floating point number!) When converting a string, use > the optional base. It is an error to supply a base when converting a > non-string. > >>> > > Jython 2.0 on java1.3.0 (JIT: null) > Type "copyright", "credits" or "license" for more information. > >>> print long.__doc__ > None > >>> print int.__doc__ > None > >>> long( "564645646465465L" ) > 564645646465465L > >>> > > -D > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users |
From: D-Man <ds...@ri...> - 2001-05-21 15:42:23
|
On Mon, May 21, 2001 at 05:37:17PM +0200, Jerome Bouat wrote: | Thanks, I will do as you say. | I keep the problem of long('564645646465465L') | with Python 1.5.2 and Jython 1.1, | so I will upgrade. Yes, I think that change was introduced in 2.0. (CPython and Jython) -D |