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.

Author martin.panter
Recipients cheryl.sabella, cubinator, docs@python, mark.dickinson, martin.panter, terry.reedy
Date 2017-04-02.03:20:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1491103232.81.0.283717141782.issue29751@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-04-02 03:20:32martin.pantersetrecipients: + martin.panter, terry.reedy, mark.dickinson, docs@python, cubinator, cheryl.sabella
2017-04-02 03:20:32martin.pantersetmessageid: <1491103232.81.0.283717141782.issue29751@psf.upfronthosting.co.za>
2017-04-02 03:20:32martin.panterlinkissue29751 messages
2017-04-02 03:20:31martin.pantercreate