why the inconsistency?

mensanator mensanator at aol.com
Tue Sep 23 21:04:33 EDT 2003


I just installed Python 2.3 (upgrading from 2.1).

Version 2.3 is noticably faster and the automatic 
conversion to long integers is very handy:

>>> print 2**64
18446744073709551616


But if I want to know how many digits 2**64 has, I can't
just do

>>> print len(2**64)
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
TypeError: len() of unsized object

So instead, I did this

>>> print len(`2**64`)
21

But the correct answer is 20, not 21. The reason the
answer is wrong

>>> print `2**64`
18446744073709551616L

Why is the "L" there? I thought "L" isn't used anymore?




More information about the Python-list mailing list