why the inconsistency?

John Roth newsgroups at jhrothjr.com
Wed Sep 24 03:55:25 CEST 2003


"mensanator" <mensanator at aol.com> wrote in message
news:fbf22ff1.0309231704.3f324abf at posting.google.com...
> 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?

I believe it's scheduled to vanish in 2.4, but I could
be wrong about that.

John Roth






More information about the Python-list mailing list