Non-symmetry of long/string conversions

Lawrence E Fitzpatrick (lef@pls.com)
Tue, 17 Jan 1995 17:33:46 GMT

Perhaps I'm not seeing things correctly, but there appears to
be some non-symmetry in the conversion between of long integers
and strings and vice versa.

If you try this:

string.atol("%s"%(string.atol("250")))

you get:

ValueError: invalid literal for atol()

What essentially happens is that the conversion from long to
string generates a string rep of appended by an 'L', and atol
barfs when it sees the 'L'.

Are there other The
Breaking it down into pieces
string.atol("250")
yields
250L <of type long integer>

Adding a layer:

"%s"%(string.atol("250"))
yields

'250L'

Then finally,
string.atol('250L')
fails.