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

PEP-563: Fixed the comments for a few examples #2013

Merged
merged 1 commit into from
Jun 29, 2021
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
10 changes: 6 additions & 4 deletions pep-0563.rst
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,16 @@ valid. They can use local names or the fully qualified name. Example::

def method(self) -> D.field2: # this FAILS, class D is local to C
... # and is therefore only available
# as C.D.
# as C.D. This was already true
# before the PEP.

def method(self) -> field2: # this is OK
...

def method(self) -> field: # this FAILS, class D doesn't
... # see C's attributes. This was
# already true before this PEP.
def method(self) -> field: # this FAILS, field is local to C and
# is therefore not visible to D unless
# accessed as C.field. This was already
# true before the PEP.

In the presence of an annotation that isn't a syntactically valid
expression, SyntaxError is raised at compile time. However, since names
Expand Down