Skip to content
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

Fix function signatures in PEP 677 #2243

Merged
merged 2 commits into from
Jan 17, 2022
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
12 changes: 6 additions & 6 deletions pep-0677.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ like tab completion, static analysis tooling, and code review.

Consider the following untyped code::

def flat_map(l, func):
def flat_map(func, l):
out = []
for element in l:
out.extend(func(element))
Expand All @@ -58,8 +58,8 @@ We can add types to this example to detect the runtime error::
from typing import Callable

def flat_map(
l: list[int],
func: Callable[[int], list[int]]
func: Callable[[int], list[int]],
l: list[int]
) -> list[int]:
....

Expand Down Expand Up @@ -91,8 +91,8 @@ the benefits of static typing. For example, they might write this::
from typing import Callable

def flat_map(
l: list[int],
func: Callable[..., Any]
func: Callable[..., Any],
l: list[int]
) -> list[int]:
....

Expand All @@ -108,8 +108,8 @@ type checkers to find the bug.
With our proposal, the example looks like this::

def flat_map(
l: list[int],
func: (int) -> list[int],
l: list[int]
) -> list[int]:
out = []
for element in l:
Expand Down