Martin Panter added the comment:

Underscores are only applicable to 3.6+, but the original concern about leading 
zeros applies to 3.5.

On Git Hub I suggested dropping the details and just referring to the Lexical 
Analysis section 
<https://docs.python.org/3.5/reference/lexical_analysis.html#integer-literals> 
for the details.

FWIW here is my understanding of integer literals (with base=0):

* 0x10 => hexadecimal
* 0b10 => binary
* 0o10 => octal (corresponds to 010 in Python 2)
* 01 => illegal (avoids conflict with Python 2)
* 00 => zero (special case; was treated as octal zero in Python 2)
* 10 => decimal (must not start with digit 0)

If you want to spell out the rules, in my mind there are four special prefixes, 
0x, 0b, 0o and 0, and the default is decimal if none of those prefixes apply.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to