Skip to content

Commit 2affb79

Browse files
committed
Documentation updates
1 parent 90db345 commit 2affb79

File tree

2 files changed

+7
-27
lines changed

2 files changed

+7
-27
lines changed

docs/source/faq.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,13 @@ existing Python VMs to take advantage of static type information, but
8686
whether this is feasible is still unknown. This is nontrivial since
8787
the runtime types do not necessarily correspond to the static types.
8888

89-
All of my code is still in Python 2. What are my options?
90-
*********************************************************
91-
92-
Mypy currently supports Python 3 syntax. Python 2 support is still in
93-
early stages of development. However, Python 2 support will be
94-
improving. Mypy includes a custom codec that lets you use Python 3
95-
function annotations in Python 2 code. The codec just removes the
96-
annotations before bytecode compilation.
89+
How do I type check my Python 2 code?
90+
*************************************
91+
92+
You can use a `comment-based function annotation syntax
93+
<https://www.python.org/dev/peps/pep-0484/#suggested-syntax-for-python-2-7-and-straddling-code>`_
94+
and use the ``--py2`` command-line option to type check your Python 2 code.
95+
You'll also need to install ``typing`` for Python 2 via ``pip install typing``.
9796

9897
Is mypy free?
9998
*************

docs/source/planned_features.rst

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,3 @@ benefit from more powerful type inference:
4343
4444
We would infer the type of ``x`` to be int in the else block due to the
4545
check against ``None`` in the if condition.
46-
47-
More general type inference
48-
---------------------------
49-
50-
It may be useful to support type inference also for variables defined
51-
in multiple locations in an if/else statement, even if the initializer
52-
types are different:
53-
54-
.. code-block:: python
55-
56-
if x:
57-
y = None # First definition of y
58-
else:
59-
y = 'a' # Second definition of y
60-
61-
In the above example, both of the assignments would be used in type
62-
inference, and the type of ``y`` would be ``str``. However, it is not
63-
obvious whether this would be generally desirable in more complex
64-
cases.

0 commit comments

Comments
 (0)