[Tutor] What does the L at the end of a number means?

Lie Ryan lie.1296 at gmail.com
Sun Mar 1 03:31:03 CET 2009


Nuno Hespanhol wrote:
> Hi.
> I have started learning phyton today!
> I was playing around with some large numbers (fibonacci series)
> and noticed that in some large calculations results have an "L" at the
> end of a number.
> Does this L stands for Large? Is there any way to disable this feature,
> so that all numbers are shown?
> 
> Thanks for your time.

"L" means it is "long integer". In the python interpreter, when you do
something like this:

>>> a

it will actually call the __repr__ of a and print it.

>>> print a.__repr__()

while

>>> print a

will call __str__ of a and print it

>>> print a.__str__()

Python 2.x's long integer __repr__ adds an extra L to denote long
integer, however the __str__ does not.



More information about the Tutor mailing list