From bccffedb1f274021552cade5f15d368e54bf0b3c Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Fri, 6 Jul 2018 14:14:48 -0700 Subject: [PATCH] Remove Python 2 references in Python 3 cheatsheet 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. --- docs/source/cheat_sheet_py3.rst | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/docs/source/cheat_sheet_py3.rst b/docs/source/cheat_sheet_py3.rst index d3988bb49e79..cd81db5986c9 100644 --- a/docs/source/cheat_sheet_py3.rst +++ b/docs/source/cheat_sheet_py3.rst @@ -47,14 +47,13 @@ Built-in types .. code-block:: python - from typing import List, Set, Dict, Tuple, Text, Optional, AnyStr + from typing import List, Set, Dict, Tuple, Optional # For simple built-in types, just use the name of the type x: int = 1 x: float = 1.0 x: bool = True x: str = "test" - x: str = u"test" x: bytes = b"test" # For collections, the name of the type is capitalized, and the @@ -71,10 +70,6 @@ Built-in types # For tuples, we specify the types of all the elements x: Tuple[int, str, float] = (3, "yes", 7.5) - # For textual data, use Text if you care about Python 2 compatibility - # ("Text" means "unicode" in Python 2 and "str" in Python 3) - x: List[Text] = ["string", u"unicode"] - # Use Optional[] for values that could be None x: Optional[str] = some_function() if x is not None: @@ -269,7 +264,6 @@ See :ref:`async-and-await` for the full detail on typing coroutines and asynchro .. code-block:: python import asyncio - from typing import Generator, Any # A coroutine is typed like a normal function async def countdown35(tag: str, count: int) -> str: