Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document support for underscores in numeric literals #2336

Merged
merged 2 commits into from
Jan 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion docs/source/python36.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,19 @@ Underscores in numeric literals (`PEP 515 <https://www.python.org/dev/peps/pep-0
Python 3.6 feature: numeric literals can contain underscores,
e.g. ``1_000_000``.

Mypy does not yet support this.
Mypy fully supports this syntax:

.. code-block:: python

precise_val = 1_000_000.000_000_1
hexes: List[int] = []
hexes.append(0x_FF_FF_FF_FF)

.. note::

This requires the ``--fast-parser`` flag and it requires that the
`typed_ast <https://pypi.python.org/pypi/typed-ast>`_ package is
installed and has at least version 0.6.2. Use ``pip3 install -U typed_ast``.

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