Skip to content

Remove Python 2 references in Python 3 cheatsheet #5326

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

Merged
merged 1 commit into from
Jul 6, 2018
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
8 changes: 1 addition & 7 deletions docs/source/cheat_sheet_py3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down