<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, 11 Feb 2016 at 00:23 Georg Brandl <<a href="mailto:g.brandl@gmx.net">g.brandl@gmx.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hey all,<br>
<br>
based on the feedback so far, I revised the PEP.  There is now<br>
a much simpler rule for allowed underscores, with no exceptions.<br>
This made the grammar simpler as well.<br>
<br>
---------------------------------------------------------------------------<br>
<br>
PEP: 515<br>
Title: Underscores in Numeric Literals<br>
Version: $Revision$<br>
Last-Modified: $Date$<br>
Author: Georg Brandl<br>
Status: Draft<br>
Type: Standards Track<br>
Content-Type: text/x-rst<br>
Created: 10-Feb-2016<br>
Python-Version: 3.6<br>
<br>
Abstract and Rationale<br>
======================<br>
<br>
This PEP proposes to extend Python's syntax so that underscores can be used in<br>
integral, floating-point and complex number literals.<br>
<br>
This is a common feature of other modern languages, and can aid readability of<br>
long literals, or literals whose value should clearly separate into parts, such<br>
as bytes or words in hexadecimal notation.<br>
<br>
Examples::<br>
<br>
    # grouping decimal numbers by thousands<br>
    amount = 10_000_000.0<br>
<br>
    # grouping hexadecimal addresses by words<br>
    addr = 0xDEAD_BEEF<br>
<br>
    # grouping bits into bytes in a binary literal<br>
    flags = 0b_0011_1111_0100_1110<br>
<br>
    # making the literal suffix stand out more<br>
    imag = 1.247812376e-15_j<br>
<br>
<br>
Specification<br>
=============<br>
<br>
The current proposal is to allow one or more consecutive underscores following<br>
digits and base specifiers in numeric literals.<br></blockquote><div><br></div><div>+1 from me. Nice and simple! And we can always update PEP 8 do disallow any usage that we deem ugly. </div></div></div>