Skip to content

Commit a924d4a

Browse files
committed
update Python domain doc
1 parent 160b5cc commit a924d4a

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

Diff for: doc/usage/restructuredtext/domains.rst

+18-5
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ The following directives are provided for module and class contents:
289289
.. py:exception:: name[type parmeters](parameters)
290290
291291
Describes an exception class. The signature can, but need not include
292-
parentheses with constructor arguments.
292+
parentheses with constructor arguments, or may optionally include type
293+
parameters (see :pep:`695`).
293294

294295
.. rubric:: options
295296

@@ -379,9 +380,9 @@ The following directives are provided for module and class contents:
379380
.. rst:directive:option:: single-line-type-parameter-list
380381
:type: no value
381382
382-
Ensure that the class constructor's type parameters are emitted on a
383-
single logical line, overriding :confval:`python_maximum_signature_line_length`
384-
and :confval:`maximum_signature_line_length`.
383+
Ensure that the class type parameters are emitted on a single logical
384+
line, overriding :confval:`python_maximum_signature_line_length` and
385+
:confval:`maximum_signature_line_length`.
385386
386387
.. rst:directive:: .. py:attribute:: name
387388
@@ -620,7 +621,19 @@ argument support), you can use brackets to specify the optional parts:
620621
It is customary to put the opening bracket before the comma.
621622

622623
Since Python 3.12, it is possible to indicate type parameters directly at the
623-
function or class definition site::
624+
function or class definition site:
625+
626+
.. code-block:: python
627+
628+
class MyDict[T](dict[str, T]):
629+
...
630+
631+
def add[T](x: T, y: T) -> T:
632+
return x + y
633+
634+
The corresponding documentation would look like::
635+
636+
.. py:class:: MyDict[T]
624637

625638
.. py:function:: add[T](x: T, y: T) -> T
626639

0 commit comments

Comments
 (0)