In Python 2.x there was a L
suffix after long integer. As Python 3 treats all integers as long integer this has been removed. From What\'s New In Python 3.0:
You misunderstood the documentation.
The remark is aimed at people trying to strip the L
from repr()
in Python 2. Those people could use str()
instead and get the same number without having to strip the L
each time.
In other words, str()
, when used on a long integer in Python 2, is the better method to convert the number to a string, as it will never add the L
suffix that repr()
would add:
Python 2.7.6 (default, Apr 28 2014, 17:17:35)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print repr(1L)
1L
>>> print str(1L)
1
Python 3 will never add the L
. Not when using repr()
, and not when using str()
. There would be no point; all integers in Python 3 are long integers.