-
-
Notifications
You must be signed in to change notification settings - Fork 3k
README.md: rearrange first paragraph to be more friendly #4002
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
Changes from 2 commits
77938e0
43f3988
998e4c3
932aa4d
5422d17
8ed7f76
db8e6df
e2b9b94
09c1055
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,17 +25,8 @@ What is mypy? | |
------------- | ||
|
||
Mypy is an optional static type checker for Python. You can add type | ||
hints to your Python programs using the standard for type | ||
annotations introduced in Python 3.5 ([PEP 484](https://www.python.org/dev/peps/pep-0484/)), and use mypy to | ||
type check them statically. Find bugs in your programs without even | ||
running them! | ||
|
||
The type annotation standard has also been backported to earlier | ||
Python 3.x versions. Mypy supports Python 3.3 and later. | ||
XML based reports do not work on Python 3.3 and 3.4 on Windows. | ||
|
||
For Python 2.7, you can add annotations as comments (this is also | ||
specified in [PEP 484](https://www.python.org/dev/peps/pep-0484/)). | ||
hints to your Python programs, and use mypy to type check them statically. | ||
Find bugs in your programs without even running them! | ||
|
||
You can mix dynamic and static typing in your programs. You can always | ||
fall back to dynamic typing when static typing is not convenient, such | ||
|
@@ -47,7 +38,8 @@ Here is a small example to whet your appetite: | |
from typing import Iterator | ||
|
||
def fib(n: int) -> Iterator[int]: | ||
a, b = 0, 1 | ||
a: int = 0 | ||
b: int = 1 | ||
while a < n: | ||
yield a | ||
a, b = b, a + b | ||
|
@@ -56,6 +48,24 @@ def fib(n: int) -> Iterator[int]: | |
Mypy is in development; some features are missing and there are bugs. | ||
See 'Development status' below. | ||
|
||
Annotations | ||
----------- | ||
For Python 3, you can add type hints to your Python programs using the standard for type | ||
annotations ([PEP 484](https://www.python.org/dev/peps/pep-0484/)). | ||
|
||
For Python 2.7, you can add annotations as comments (this is also | ||
specified in [PEP 484](https://www.python.org/dev/peps/pep-0484/)): | ||
```python | ||
from typing import Iterator | ||
|
||
def fib(n): # type: int -> Iterator[int] | ||
a = 0 # type: int | ||
b = 1 # type: int | ||
while a < n: | ||
yield a | ||
a, b = b, a + b | ||
``` | ||
|
||
|
||
Requirements | ||
------------ | ||
|
@@ -158,7 +168,8 @@ In Windows, the script is generally installed in | |
C:\>\Python34\python \Python34\Scripts\mypy PROGRAM | ||
|
||
If you are on Windows using Python 3.3 or 3.4, and would like to use XML reports | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If #4007 gets merged before this, this sentence can be removed, as there are wheels for all Python versions on Windows now, and installing via test-requirements will "just work". |
||
download LXML from [PyPi](https://pypi.python.org/pypi/lxml). | ||
download LXML from [PyPi](https://pypi.python.org/pypi/lxml). | ||
XML based reports do not work on Python 3.3 and 3.4 on Windows. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They do work, but only if you have LXML installed. The last sentence can be deleted. |
||
|
||
### Working with `virtualenv` | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good move 🚜