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: bin(long) doesn't have a trailing 'L'
Type: Stage:
Components: Interpreter Core Versions: Python 2.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: eric.smith, mark.dickinson, rhettinger
Priority: normal Keywords:

Created on 2008-06-24 08:55 by mark.dickinson, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg68672 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2008-06-24 08:55
In Python 2.6, for a long n, hex(n) and oct(n) have a trailing 'L', while 
bin(n) does not:

>>> hex(1L)
'0x1L'
>>> oct(1L)
'01L'
>>> bin(1L)
'0b1'

I'm guessing that this is intentional, and that the only reason hex(n) and 
oct(n) still have a trailing 'L' is backwards compatibility, but I thought 
I'd better check.
msg68680 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2008-06-24 12:08
See
http://mail.python.org/pipermail/python-dev/2008-February/077062.html,
where Guido endorses my approach to implementing bin() without the
trailing L for longs.

Note that he also agrees with not adding a __bin__ function, which was
implemented in r64424.  I disagree with adding __bin__ to 2.6.
msg68681 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2008-06-24 12:17
Ah.  I missed this.  Apologies.

Sorry for the noise.
History
Date User Action Args
2022-04-11 14:56:35adminsetgithub: 47436
2008-06-24 12:17:44mark.dickinsonsetstatus: open -> closed
resolution: not a bug
messages: + msg68681
2008-06-24 12:08:36eric.smithsetnosy: + eric.smith
messages: + msg68680
components: + Interpreter Core
2008-06-24 08:55:47mark.dickinsoncreate