Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bin(long) doesn't have a trailing 'L' #47436

Closed
mdickinson opened this issue Jun 24, 2008 · 3 comments
Closed

bin(long) doesn't have a trailing 'L' #47436

mdickinson opened this issue Jun 24, 2008 · 3 comments
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@mdickinson
Copy link
Member

BPO 3186
Nosy @rhettinger, @mdickinson, @ericvsmith

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/rhettinger'
closed_at = <Date 2008-06-24.12:17:44.391>
created_at = <Date 2008-06-24.08:55:47.110>
labels = ['interpreter-core', 'invalid']
title = "bin(long) doesn't have a trailing 'L'"
updated_at = <Date 2008-06-24.12:17:44.390>
user = 'https://github.com/mdickinson'

bugs.python.org fields:

activity = <Date 2008-06-24.12:17:44.390>
actor = 'mark.dickinson'
assignee = 'rhettinger'
closed = True
closed_date = <Date 2008-06-24.12:17:44.391>
closer = 'mark.dickinson'
components = ['Interpreter Core']
creation = <Date 2008-06-24.08:55:47.110>
creator = 'mark.dickinson'
dependencies = []
files = []
hgrepos = []
issue_num = 3186
keywords = []
message_count = 3.0
messages = ['68672', '68680', '68681']
nosy_count = 3.0
nosy_names = ['rhettinger', 'mark.dickinson', 'eric.smith']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue3186'
versions = ['Python 2.6']

@mdickinson
Copy link
Member Author

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.

@ericvsmith
Copy link
Member

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.

@ericvsmith ericvsmith added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Jun 24, 2008
@mdickinson
Copy link
Member Author

Ah. I missed this. Apologies.

Sorry for the noise.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)
Projects
None yet
Development

No branches or pull requests

3 participants