This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Use of 'L' specifier is inconsistent when printing long integers
Type: enhancement Stage: resolved
Components: None Versions: Python 2.6
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, eric.smith, kostja
Priority: normal Keywords:

Created on 2011-01-28 11:23 by kostja, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg127284 - (view) Author: Konstantin Osipov (kostja) Date: 2011-01-28 11:23
I'm using a 64 bit system, but the issue is as well repeatable on 32 bit systems: 

kostja@shmita:~$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 0xffffffffffffffff
18446744073709551615L
>>> [0xffffffffffffffff]
[18446744073709551615L]
>>> str(0xffffffffffffffff)
'18446744073709551615'
>>> str([0xffffffffffffffff])
'[18446744073709551615L]'

Notice the 'L' specifier disappears when creating a string from an integer. I.e. depending on conversion order, 'L' specifier is present or absent in the resulting string representation.

I don't know the reason why 'L' specifier is necessary at all when printing integers, rather, I'd say it's very harmful, because makes Python program platform-dependent (since int is mapped to C long, 32-bit systems print 'L' where 64-bit systems don't), but please at least make the output consistent!

Thanks,
-- 
kostja
msg127294 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2011-01-28 12:45
There is no suffix in python 3.x. Since this is a feature request, and there will be no new releases of 2.x, I'm closing this.
msg127298 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2011-01-28 13:12
Python objects can have two textual representations: see the difference between str() and repr():
http://docs.python.org/tutorial/inputoutput.html
And indeed, Python3 chose to drop the 'L' suffix.
History
Date User Action Args
2022-04-11 14:57:12adminsetgithub: 55248
2011-01-28 13:12:47amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg127298
2011-01-28 12:45:19eric.smithsetstatus: open -> closed

type: enhancement

nosy: + eric.smith
messages: + msg127294
resolution: rejected
stage: resolved
2011-01-28 11:23:24kostjacreate