python-peps/pep-0515/index.html

344 lines
25 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="color-scheme" content="light dark">
<title>PEP 515 Underscores in Numeric Literals | peps.python.org</title>
<link rel="shortcut icon" href="../_static/py.png">
<link rel="canonical" href="https://peps.python.org/pep-0515/">
<link rel="stylesheet" href="../_static/style.css" type="text/css">
<link rel="stylesheet" href="../_static/mq.css" type="text/css">
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" media="(prefers-color-scheme: light)" id="pyg-light">
<link rel="stylesheet" href="../_static/pygments_dark.css" type="text/css" media="(prefers-color-scheme: dark)" id="pyg-dark">
<link rel="alternate" type="application/rss+xml" title="Latest PEPs" href="https://peps.python.org/peps.rss">
<meta property="og:title" content='PEP 515 Underscores in Numeric Literals | peps.python.org'>
<meta property="og:description" content="Python Enhancement Proposals (PEPs)">
<meta property="og:type" content="website">
<meta property="og:url" content="https://peps.python.org/pep-0515/">
<meta property="og:site_name" content="Python Enhancement Proposals (PEPs)">
<meta property="og:image" content="https://peps.python.org/_static/og-image.png">
<meta property="og:image:alt" content="Python PEPs">
<meta property="og:image:width" content="200">
<meta property="og:image:height" content="200">
<meta name="description" content="Python Enhancement Proposals (PEPs)">
<meta name="theme-color" content="#3776ab">
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="svg-sun-half" viewBox="0 0 24 24" pointer-events="all">
<title>Following system colour scheme</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="9"></circle>
<path d="M12 3v18m0-12l4.65-4.65M12 14.3l7.37-7.37M12 19.6l8.85-8.85"></path>
</svg>
</symbol>
<symbol id="svg-moon" viewBox="0 0 24 24" pointer-events="all">
<title>Selected dark colour scheme</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z"></path>
</svg>
</symbol>
<symbol id="svg-sun" viewBox="0 0 24 24" pointer-events="all">
<title>Selected light colour scheme</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
</symbol>
</svg>
<script>
document.documentElement.dataset.colour_scheme = localStorage.getItem("colour_scheme") || "auto"
</script>
<section id="pep-page-section">
<header>
<h1>Python Enhancement Proposals</h1>
<ul class="breadcrumbs">
<li><a href="https://www.python.org/" title="The Python Programming Language">Python</a> &raquo; </li>
<li><a href="../pep-0000/">PEP Index</a> &raquo; </li>
<li>PEP 515</li>
</ul>
<button id="colour-scheme-cycler" onClick="setColourScheme(nextColourScheme())">
<svg aria-hidden="true" class="colour-scheme-icon-when-auto"><use href="#svg-sun-half"></use></svg>
<svg aria-hidden="true" class="colour-scheme-icon-when-dark"><use href="#svg-moon"></use></svg>
<svg aria-hidden="true" class="colour-scheme-icon-when-light"><use href="#svg-sun"></use></svg>
<span class="visually-hidden">Toggle light / dark / auto colour theme</span>
</button>
</header>
<article>
<section id="pep-content">
<h1 class="page-title">PEP 515 Underscores in Numeric Literals</h1>
<dl class="rfc2822 field-list simple">
<dt class="field-odd">Author<span class="colon">:</span></dt>
<dd class="field-odd">Georg Brandl, Serhiy Storchaka</dd>
<dt class="field-even">Status<span class="colon">:</span></dt>
<dd class="field-even"><abbr title="Accepted and implementation complete, or no longer active">Final</abbr></dd>
<dt class="field-odd">Type<span class="colon">:</span></dt>
<dd class="field-odd"><abbr title="Normative PEP with a new feature for Python, implementation change for CPython or interoperability standard for the ecosystem">Standards Track</abbr></dd>
<dt class="field-even">Created<span class="colon">:</span></dt>
<dd class="field-even">10-Feb-2016</dd>
<dt class="field-odd">Python-Version<span class="colon">:</span></dt>
<dd class="field-odd">3.6</dd>
<dt class="field-even">Post-History<span class="colon">:</span></dt>
<dd class="field-even">10-Feb-2016, 11-Feb-2016</dd>
</dl>
<hr class="docutils" />
<section id="contents">
<details><summary>Table of Contents</summary><ul class="simple">
<li><a class="reference internal" href="#abstract-and-rationale">Abstract and Rationale</a></li>
<li><a class="reference internal" href="#specification">Specification</a><ul>
<li><a class="reference internal" href="#literal-grammar">Literal Grammar</a></li>
<li><a class="reference internal" href="#constructors">Constructors</a></li>
<li><a class="reference internal" href="#further-changes">Further changes</a></li>
</ul>
</li>
<li><a class="reference internal" href="#prior-art">Prior Art</a></li>
<li><a class="reference internal" href="#alternative-syntax">Alternative Syntax</a><ul>
<li><a class="reference internal" href="#underscore-placement-rules">Underscore Placement Rules</a></li>
<li><a class="reference internal" href="#different-separators">Different Separators</a></li>
</ul>
</li>
<li><a class="reference internal" href="#implementation">Implementation</a></li>
<li><a class="reference internal" href="#references">References</a></li>
<li><a class="reference internal" href="#copyright">Copyright</a></li>
</ul>
</details></section>
<section id="abstract-and-rationale">
<h2><a class="toc-backref" href="#abstract-and-rationale" role="doc-backlink">Abstract and Rationale</a></h2>
<p>This PEP proposes to extend Pythons syntax and number-from-string
constructors so that underscores can be used as visual separators for
digit grouping purposes in integral, floating-point and complex number
literals.</p>
<p>This is a common feature of other modern languages, and can aid
readability of long literals, or literals whose value should clearly
separate into parts, such as bytes or words in hexadecimal notation.</p>
<p>Examples:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># grouping decimal numbers by thousands</span>
<span class="n">amount</span> <span class="o">=</span> <span class="mf">10_000_000.0</span>
<span class="c1"># grouping hexadecimal addresses by words</span>
<span class="n">addr</span> <span class="o">=</span> <span class="mh">0xCAFE_F00D</span>
<span class="c1"># grouping bits into nibbles in a binary literal</span>
<span class="n">flags</span> <span class="o">=</span> <span class="mb">0b_0011_1111_0100_1110</span>
<span class="c1"># same, for string conversions</span>
<span class="n">flags</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="s1">&#39;0b_1111_0000&#39;</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
</pre></div>
</div>
</section>
<section id="specification">
<h2><a class="toc-backref" href="#specification" role="doc-backlink">Specification</a></h2>
<p>The current proposal is to allow one underscore between digits, and
after base specifiers in numeric literals. The underscores have no
semantic meaning, and literals are parsed as if the underscores were
absent.</p>
<section id="literal-grammar">
<h3><a class="toc-backref" href="#literal-grammar" role="doc-backlink">Literal Grammar</a></h3>
<p>The production list for integer literals would therefore look like
this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">integer</span><span class="p">:</span> <span class="n">decinteger</span> <span class="o">|</span> <span class="n">bininteger</span> <span class="o">|</span> <span class="n">octinteger</span> <span class="o">|</span> <span class="n">hexinteger</span>
<span class="n">decinteger</span><span class="p">:</span> <span class="n">nonzerodigit</span> <span class="p">([</span><span class="s2">&quot;_&quot;</span><span class="p">]</span> <span class="n">digit</span><span class="p">)</span><span class="o">*</span> <span class="o">|</span> <span class="s2">&quot;0&quot;</span> <span class="p">([</span><span class="s2">&quot;_&quot;</span><span class="p">]</span> <span class="s2">&quot;0&quot;</span><span class="p">)</span><span class="o">*</span>
<span class="n">bininteger</span><span class="p">:</span> <span class="s2">&quot;0&quot;</span> <span class="p">(</span><span class="s2">&quot;b&quot;</span> <span class="o">|</span> <span class="s2">&quot;B&quot;</span><span class="p">)</span> <span class="p">([</span><span class="s2">&quot;_&quot;</span><span class="p">]</span> <span class="n">bindigit</span><span class="p">)</span><span class="o">+</span>
<span class="n">octinteger</span><span class="p">:</span> <span class="s2">&quot;0&quot;</span> <span class="p">(</span><span class="s2">&quot;o&quot;</span> <span class="o">|</span> <span class="s2">&quot;O&quot;</span><span class="p">)</span> <span class="p">([</span><span class="s2">&quot;_&quot;</span><span class="p">]</span> <span class="n">octdigit</span><span class="p">)</span><span class="o">+</span>
<span class="n">hexinteger</span><span class="p">:</span> <span class="s2">&quot;0&quot;</span> <span class="p">(</span><span class="s2">&quot;x&quot;</span> <span class="o">|</span> <span class="s2">&quot;X&quot;</span><span class="p">)</span> <span class="p">([</span><span class="s2">&quot;_&quot;</span><span class="p">]</span> <span class="n">hexdigit</span><span class="p">)</span><span class="o">+</span>
<span class="n">nonzerodigit</span><span class="p">:</span> <span class="s2">&quot;1&quot;</span><span class="o">...</span><span class="s2">&quot;9&quot;</span>
<span class="n">digit</span><span class="p">:</span> <span class="s2">&quot;0&quot;</span><span class="o">...</span><span class="s2">&quot;9&quot;</span>
<span class="n">bindigit</span><span class="p">:</span> <span class="s2">&quot;0&quot;</span> <span class="o">|</span> <span class="s2">&quot;1&quot;</span>
<span class="n">octdigit</span><span class="p">:</span> <span class="s2">&quot;0&quot;</span><span class="o">...</span><span class="s2">&quot;7&quot;</span>
<span class="n">hexdigit</span><span class="p">:</span> <span class="n">digit</span> <span class="o">|</span> <span class="s2">&quot;a&quot;</span><span class="o">...</span><span class="s2">&quot;f&quot;</span> <span class="o">|</span> <span class="s2">&quot;A&quot;</span><span class="o">...</span><span class="s2">&quot;F&quot;</span>
</pre></div>
</div>
<p>For floating-point and complex literals:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">floatnumber</span><span class="p">:</span> <span class="n">pointfloat</span> <span class="o">|</span> <span class="n">exponentfloat</span>
<span class="n">pointfloat</span><span class="p">:</span> <span class="p">[</span><span class="n">digitpart</span><span class="p">]</span> <span class="n">fraction</span> <span class="o">|</span> <span class="n">digitpart</span> <span class="s2">&quot;.&quot;</span>
<span class="n">exponentfloat</span><span class="p">:</span> <span class="p">(</span><span class="n">digitpart</span> <span class="o">|</span> <span class="n">pointfloat</span><span class="p">)</span> <span class="n">exponent</span>
<span class="n">digitpart</span><span class="p">:</span> <span class="n">digit</span> <span class="p">([</span><span class="s2">&quot;_&quot;</span><span class="p">]</span> <span class="n">digit</span><span class="p">)</span><span class="o">*</span>
<span class="n">fraction</span><span class="p">:</span> <span class="s2">&quot;.&quot;</span> <span class="n">digitpart</span>
<span class="n">exponent</span><span class="p">:</span> <span class="p">(</span><span class="s2">&quot;e&quot;</span> <span class="o">|</span> <span class="s2">&quot;E&quot;</span><span class="p">)</span> <span class="p">[</span><span class="s2">&quot;+&quot;</span> <span class="o">|</span> <span class="s2">&quot;-&quot;</span><span class="p">]</span> <span class="n">digitpart</span>
<span class="n">imagnumber</span><span class="p">:</span> <span class="p">(</span><span class="n">floatnumber</span> <span class="o">|</span> <span class="n">digitpart</span><span class="p">)</span> <span class="p">(</span><span class="s2">&quot;j&quot;</span> <span class="o">|</span> <span class="s2">&quot;J&quot;</span><span class="p">)</span>
</pre></div>
</div>
</section>
<section id="constructors">
<h3><a class="toc-backref" href="#constructors" role="doc-backlink">Constructors</a></h3>
<p>Following the same rules for placement, underscores will be allowed in
the following constructors:</p>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">int()</span></code> (with any base)</li>
<li><code class="docutils literal notranslate"><span class="pre">float()</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">complex()</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">Decimal()</span></code></li>
</ul>
</section>
<section id="further-changes">
<h3><a class="toc-backref" href="#further-changes" role="doc-backlink">Further changes</a></h3>
<p>The new-style number-to-string formatting language will be extended to
allow <code class="docutils literal notranslate"><span class="pre">_</span></code> as a thousands separator, where currently only <code class="docutils literal notranslate"><span class="pre">,</span></code> is
supported. This can be used to easily generate code with more
readable literals. <a class="footnote-reference brackets" href="#id24" id="id1">[11]</a></p>
<p>The syntax would be the same as for the comma, e.g. <code class="docutils literal notranslate"><span class="pre">{:10_}</span></code> for a
width of 10 with <code class="docutils literal notranslate"><span class="pre">_</span></code> separator.</p>
<p>For the <code class="docutils literal notranslate"><span class="pre">b</span></code>, <code class="docutils literal notranslate"><span class="pre">x</span></code> and <code class="docutils literal notranslate"><span class="pre">o</span></code> format specifiers, <code class="docutils literal notranslate"><span class="pre">_</span></code> will be
allowed and group by 4 digits.</p>
</section>
</section>
<section id="prior-art">
<h2><a class="toc-backref" href="#prior-art" role="doc-backlink">Prior Art</a></h2>
<p>Those languages that do allow underscore grouping implement a large
variety of rules for allowed placement of underscores. In cases where
the language spec contradicts the actual behavior, the actual behavior
is listed. (“single” or “multiple” refer to allowing runs of
consecutive underscores.)</p>
<ul class="simple">
<li>Ada: single, only between digits <a class="footnote-reference brackets" href="#id21" id="id2">[8]</a></li>
<li>C# (open proposal for 7.0): multiple, only between digits <a class="footnote-reference brackets" href="#id19" id="id3">[6]</a></li>
<li>C++14: single, between digits (different separator chosen) <a class="footnote-reference brackets" href="#id14" id="id4">[1]</a></li>
<li>D: multiple, anywhere, including trailing <a class="footnote-reference brackets" href="#id15" id="id5">[2]</a></li>
<li>Java: multiple, only between digits <a class="footnote-reference brackets" href="#id20" id="id6">[7]</a></li>
<li>Julia: single, only between digits (but not in float exponent parts)
<a class="footnote-reference brackets" href="#id22" id="id7">[9]</a></li>
<li>Perl 5: multiple, basically anywhere, although docs say its
restricted to one underscore between digits <a class="footnote-reference brackets" href="#id16" id="id8">[3]</a></li>
<li>Ruby: single, only between digits (although docs say “anywhere”)
<a class="footnote-reference brackets" href="#id23" id="id9">[10]</a></li>
<li>Rust: multiple, anywhere, except for between exponent “e” and digits
<a class="footnote-reference brackets" href="#id17" id="id10">[4]</a></li>
<li>Swift: multiple, between digits and trailing (although textual
description says only “between digits”) <a class="footnote-reference brackets" href="#id18" id="id11">[5]</a></li>
</ul>
</section>
<section id="alternative-syntax">
<h2><a class="toc-backref" href="#alternative-syntax" role="doc-backlink">Alternative Syntax</a></h2>
<section id="underscore-placement-rules">
<h3><a class="toc-backref" href="#underscore-placement-rules" role="doc-backlink">Underscore Placement Rules</a></h3>
<p>Instead of the relatively strict rule specified above, the use of
underscores could be less limited. As seen in other languages, common
rules include:</p>
<ul class="simple">
<li>Only one consecutive underscore allowed, and only between digits.</li>
<li>Multiple consecutive underscores allowed, but only between digits.</li>
<li>Multiple consecutive underscores allowed, in most positions except
for the start of the literal, or special positions like after a
decimal point.</li>
</ul>
<p>The syntax in this PEP has ultimately been selected because it covers
the common use cases, and does not allow for syntax that would have to
be discouraged in style guides anyway.</p>
<p>A less common rule would be to allow underscores only every N digits
(where N could be 3 for decimal literals, or 4 for hexadecimal ones).
This is unnecessarily restrictive, especially considering the
separator placement is different in different cultures.</p>
</section>
<section id="different-separators">
<h3><a class="toc-backref" href="#different-separators" role="doc-backlink">Different Separators</a></h3>
<p>A proposed alternate syntax was to use whitespace for grouping.
Although strings are a precedent for combining adjoining literals, the
behavior can lead to unexpected effects which are not possible with
underscores. Also, no other language is known to use this rule,
except for languages that generally disregard any whitespace.</p>
<p>C++14 introduces apostrophes for grouping (because underscores
introduce ambiguity with user-defined literals), which is not
considered because of the use in Pythons string literals. <a class="footnote-reference brackets" href="#id14" id="id12">[1]</a></p>
</section>
</section>
<section id="implementation">
<h2><a class="toc-backref" href="#implementation" role="doc-backlink">Implementation</a></h2>
<p>A preliminary patch that implements the specification given above has
been posted to the issue tracker. <a class="footnote-reference brackets" href="#id25" id="id13">[12]</a></p>
</section>
<section id="references">
<h2><a class="toc-backref" href="#references" role="doc-backlink">References</a></h2>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="id14" role="doc-footnote">
<dt class="label" id="id14">[1]<em> (<a href='#id4'>1</a>, <a href='#id12'>2</a>) </em></dt>
<dd><a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3499.html">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3499.html</a></aside>
<aside class="footnote brackets" id="id15" role="doc-footnote">
<dt class="label" id="id15">[<a href="#id5">2</a>]</dt>
<dd><a class="reference external" href="https://dlang.org/spec/lex.html#integerliteral">https://dlang.org/spec/lex.html#integerliteral</a></aside>
<aside class="footnote brackets" id="id16" role="doc-footnote">
<dt class="label" id="id16">[<a href="#id8">3</a>]</dt>
<dd><a class="reference external" href="https://perldoc.perl.org/perldata#Scalar-value-constructors">https://perldoc.perl.org/perldata#Scalar-value-constructors</a></aside>
<aside class="footnote brackets" id="id17" role="doc-footnote">
<dt class="label" id="id17">[<a href="#id10">4</a>]</dt>
<dd><a class="reference external" href="https://web.archive.org/web/20160304121349/http://doc.rust-lang.org/reference.html#integer-literals">https://web.archive.org/web/20160304121349/http://doc.rust-lang.org/reference.html#integer-literals</a></aside>
<aside class="footnote brackets" id="id18" role="doc-footnote">
<dt class="label" id="id18">[<a href="#id11">5</a>]</dt>
<dd><a class="reference external" href="https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html">https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html</a></aside>
<aside class="footnote brackets" id="id19" role="doc-footnote">
<dt class="label" id="id19">[<a href="#id3">6</a>]</dt>
<dd><a class="reference external" href="https://github.com/dotnet/roslyn/issues/216">https://github.com/dotnet/roslyn/issues/216</a></aside>
<aside class="footnote brackets" id="id20" role="doc-footnote">
<dt class="label" id="id20">[<a href="#id6">7</a>]</dt>
<dd><a class="reference external" href="https://docs.oracle.com/javase/7/docs/technotes/guides/language/underscores-literals.html">https://docs.oracle.com/javase/7/docs/technotes/guides/language/underscores-literals.html</a></aside>
<aside class="footnote brackets" id="id21" role="doc-footnote">
<dt class="label" id="id21">[<a href="#id2">8</a>]</dt>
<dd><a class="reference external" href="http://archive.adaic.com/standards/83lrm/html/lrm-02-04.html#2.4">http://archive.adaic.com/standards/83lrm/html/lrm-02-04.html#2.4</a></aside>
<aside class="footnote brackets" id="id22" role="doc-footnote">
<dt class="label" id="id22">[<a href="#id7">9</a>]</dt>
<dd><a class="reference external" href="https://web.archive.org/web/20160223175334/http://docs.julialang.org/en/release-0.4/manual/integers-and-floating-point-numbers/">https://web.archive.org/web/20160223175334/http://docs.julialang.org/en/release-0.4/manual/integers-and-floating-point-numbers/</a></aside>
<aside class="footnote brackets" id="id23" role="doc-footnote">
<dt class="label" id="id23">[<a href="#id9">10</a>]</dt>
<dd><a class="reference external" href="https://ruby-doc.org/core-2.3.0/doc/syntax/literals_rdoc.html#label-Numbers">https://ruby-doc.org/core-2.3.0/doc/syntax/literals_rdoc.html#label-Numbers</a></aside>
<aside class="footnote brackets" id="id24" role="doc-footnote">
<dt class="label" id="id24">[<a href="#id1">11</a>]</dt>
<dd><a class="reference external" href="https://mail.python.org/pipermail/python-dev/2016-February/143283.html">https://mail.python.org/pipermail/python-dev/2016-February/143283.html</a></aside>
<aside class="footnote brackets" id="id25" role="doc-footnote">
<dt class="label" id="id25">[<a href="#id13">12</a>]</dt>
<dd><a class="reference external" href="http://bugs.python.org/issue26331">http://bugs.python.org/issue26331</a></aside>
</aside>
</section>
<section id="copyright">
<h2><a class="toc-backref" href="#copyright" role="doc-backlink">Copyright</a></h2>
<p>This document has been placed in the public domain.</p>
</section>
</section>
<hr class="docutils" />
<p>Source: <a class="reference external" href="https://github.com/python/peps/blob/main/peps/pep-0515.rst">https://github.com/python/peps/blob/main/peps/pep-0515.rst</a></p>
<p>Last modified: <a class="reference external" href="https://github.com/python/peps/commits/main/peps/pep-0515.rst">2023-09-09 17:39:29 GMT</a></p>
</article>
<nav id="pep-sidebar">
<h2>Contents</h2>
<ul>
<li><a class="reference internal" href="#abstract-and-rationale">Abstract and Rationale</a></li>
<li><a class="reference internal" href="#specification">Specification</a><ul>
<li><a class="reference internal" href="#literal-grammar">Literal Grammar</a></li>
<li><a class="reference internal" href="#constructors">Constructors</a></li>
<li><a class="reference internal" href="#further-changes">Further changes</a></li>
</ul>
</li>
<li><a class="reference internal" href="#prior-art">Prior Art</a></li>
<li><a class="reference internal" href="#alternative-syntax">Alternative Syntax</a><ul>
<li><a class="reference internal" href="#underscore-placement-rules">Underscore Placement Rules</a></li>
<li><a class="reference internal" href="#different-separators">Different Separators</a></li>
</ul>
</li>
<li><a class="reference internal" href="#implementation">Implementation</a></li>
<li><a class="reference internal" href="#references">References</a></li>
<li><a class="reference internal" href="#copyright">Copyright</a></li>
</ul>
<br>
<a id="source" href="https://github.com/python/peps/blob/main/peps/pep-0515.rst">Page Source (GitHub)</a>
</nav>
</section>
<script src="../_static/colour_scheme.js"></script>
<script src="../_static/wrap_tables.js"></script>
<script src="../_static/sticky_banner.js"></script>
</body>
</html>