Skip to content

Commit dbacb8c

Browse files
ilevkivskyiddfisher
authored andcommitted
Document support for underscores in numeric literals (#2336)
1 parent 4af9f5d commit dbacb8c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

docs/source/python36.rst

+13-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,19 @@ Underscores in numeric literals (`PEP 515 <https://www.python.org/dev/peps/pep-0
6363
Python 3.6 feature: numeric literals can contain underscores,
6464
e.g. ``1_000_000``.
6565

66-
Mypy does not yet support this.
66+
Mypy fully supports this syntax:
67+
68+
.. code-block:: python
69+
70+
precise_val = 1_000_000.000_000_1
71+
hexes: List[int] = []
72+
hexes.append(0x_FF_FF_FF_FF)
73+
74+
.. note::
75+
76+
This requires the ``--fast-parser`` flag and it requires that the
77+
`typed_ast <https://pypi.python.org/pypi/typed-ast>`_ package is
78+
installed and has at least version 0.6.2. Use ``pip3 install -U typed_ast``.
6779

6880
Asynchronous generators (`PEP 525 <https://www.python.org/dev/peps/pep-0525>`_)
6981
-------------------------------------------------------------------------------

0 commit comments

Comments
 (0)