Skip to content

Commit

Permalink
writing_stubs: add examples of allowed and disallowed language features.
Browse files Browse the repository at this point in the history
  • Loading branch information
rchen152 committed Aug 9, 2024
1 parent 0b4e1aa commit 3edea67
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docs/guides/writing_stubs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,14 @@ Language Features
-----------------

Use the latest language features available, even for stubs targeting older
Python versions. Do not use quotes around forward references and do not use
``__future__`` imports. See :ref:`stub-file-syntax` for more information.
Python versions. For example, Python 3.7 added the ``async`` keyword (see
:pep:`492`). Stubs should use it to mark coroutines, even if the implementation
still uses the ``@coroutine`` decorator. On the other hand, the ``type`` soft
keyword from :pep:`695`, introduced in Python 3.12, should not be used in stubs
until Python 3.11 reaches end-of-life in October 2027.

Do not use quotes around forward references and do not use ``__future__``
imports. See :ref:`stub-file-syntax` for more information.

Yes::

Expand Down

0 comments on commit 3edea67

Please sign in to comment.