Skip to content

Commit

Permalink
Update protocol.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
rchen152 authored Oct 31, 2024
1 parent 5d3c1f8 commit 599d41a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/spec/protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ from regular ABCs, where abstractness is simply defined by having at least one
abstract method being unimplemented. Protocol classes must be marked
*explicitly*.

.. _`generic-protocols`:

Generic protocols
^^^^^^^^^^^^^^^^^
Expand All @@ -271,7 +272,8 @@ non-protocol generic types::
...

``Protocol[T, S, ...]`` is allowed as a shorthand for
``Protocol, Generic[T, S, ...]``.
``Protocol, Generic[T, S, ...]``. It is an error to include both
``Protocol[T, S, ...]`` and ``Generic[T, S, ...]`` in a class definition.

User-defined generic protocols support explicitly declared variance.
Type checkers will warn if the inferred variance is different from
Expand Down

0 comments on commit 599d41a

Please sign in to comment.