Long integers: to L or not to L?

Tetsuo member16943 at dbforums.com
Wed Mar 12 01:00:54 EST 2003


I have a function that uses longs, and also of the length of their
equivalent strings. I thought that longs have an L at the end, so I
suntracted 2 instead of 1 from the length. The program gave wrong
results. I put print statements in. The value returned by function
long(n) was a plain integer, with no L. I checked the type of that
return value. Long. So why no L?

Also, why does this raise an error? (numbers in front of lines indicate
levels of indentation)

 def h():
1     i = 0
1     def h1():
3         i = i + 1
3         print 1, i
3        if i == 5:
4             return i
3         else:
4             i = h1()
4             return i
1    i = h1()
1    print 2, i

Posting code is annoying...

--
Posted via http://dbforums.com




More information about the Python-list mailing list