Skip to content

Commit 036b193

Browse files
JelleZijlstragvanrossum
authored andcommitted
Remove Python 2 references in Python 3 cheatsheet (#5326)
The Python 3 cheatsheet is for people who can use the Python 3 syntax and don't need to care about Python 2 compatibility, so I don't think it's useful to mention Python 2 compatibility issues. Also removed some unused imports.
1 parent 1e7b517 commit 036b193

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

docs/source/cheat_sheet_py3.rst

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,13 @@ Built-in types
4747

4848
.. code-block:: python
4949
50-
from typing import List, Set, Dict, Tuple, Text, Optional, AnyStr
50+
from typing import List, Set, Dict, Tuple, Optional
5151
5252
# For simple built-in types, just use the name of the type
5353
x: int = 1
5454
x: float = 1.0
5555
x: bool = True
5656
x: str = "test"
57-
x: str = u"test"
5857
x: bytes = b"test"
5958
6059
# For collections, the name of the type is capitalized, and the
@@ -71,10 +70,6 @@ Built-in types
7170
# For tuples, we specify the types of all the elements
7271
x: Tuple[int, str, float] = (3, "yes", 7.5)
7372
74-
# For textual data, use Text if you care about Python 2 compatibility
75-
# ("Text" means "unicode" in Python 2 and "str" in Python 3)
76-
x: List[Text] = ["string", u"unicode"]
77-
7873
# Use Optional[] for values that could be None
7974
x: Optional[str] = some_function()
8075
if x is not None:
@@ -269,7 +264,6 @@ See :ref:`async-and-await` for the full detail on typing coroutines and asynchro
269264
.. code-block:: python
270265
271266
import asyncio
272-
from typing import Generator, Any
273267
274268
# A coroutine is typed like a normal function
275269
async def countdown35(tag: str, count: int) -> str:

0 commit comments

Comments
 (0)