@@ -120,6 +120,45 @@ The following directives are provided for module and class contents:
120120
121121      .. versionadded:: 7.1 
122122
123+    ..  rst:directive:option:: subscript 
124+       :type: no value 
125+ 
126+       Indicate that the function's parameters should be displayed 
127+       within square brackets instead of parentheses, in order to 
128+       indicate that it must be invoked as a *subscript function*.. 
129+ 
130+       For example: 
131+ 
132+       .. code-block:: rst 
133+ 
134+          .. py:function:: numpy.s_(indexing_expr: tuple[int, ...]) -> IndexExpression 
135+             :subscript: 
136+ 
137+             Creates an index expression object. 
138+ 
139+       This is rendered as: 
140+ 
141+       .. py:method:: numpy.s_(indexing_expr: tuple[int, ...]) -> IndexExpression 
142+          :no-contents-entry: 
143+          :no-index-entry: 
144+          :subscript: 
145+ 
146+          Creates an index expression object. 
147+ 
148+       A *subscript function* can be implemented as follows: 
149+ 
150+       .. code-block:: python 
151+ 
152+ 
153+ 	     @staticmethod
154+ 	     def __getitem__(indexing_expr: tuple[int, ...]) -> IndexExpression:
155+ 		 ...
156+ 
157+          s _ = _S()
158+ 
159+       .. versionadded :: 8.3 
160+       
161+ 
123162
124163.. rst :directive :: .. py:data:: name 
125164
@@ -516,6 +555,46 @@ The following directives are provided for module and class contents:
516555
517556      .. versionadded:: 2.1 
518557
558+    ..  rst:directive:option:: subscript 
559+       :type: no value 
560+ 
561+       Indicate that the method's parameters should be displayed within 
562+       square brackets instead of parentheses, in order to indicate 
563+       that it must be invoked as a *subscript method*. 
564+ 
565+       For example: 
566+ 
567+       .. code-block:: rst 
568+ 
569+          .. py:method:: Array.vindex(self, indexing_expr: tuple[int, ...]) -> list[int] 
570+             :subscript: 
571+ 
572+             Index the array using *vindex* semantics. 
573+ 
574+       This is rendered as: 
575+ 
576+       .. py:method:: Array.vindex(self, indexing_expr: tuple[int, ...]) -> list[int] 
577+          :no-contents-entry: 
578+          :no-index-entry: 
579+          :subscript: 
580+ 
581+          Index the array using *vindex* semantics. 
582+ 
583+       A *subscript method* can be implemented as follows: 
584+ 
585+       .. code-block:: python 
586+ 
587+          class Array: 
588+              class _Vindex: 
589+                  def __init__(self, parent: Array): 
590+                      self.parent = parent 
591+                  def __getitem__(self, indexing_expr: tuple[int, ...]) -> list[int]: 
592+                      ... 
593+              @property 
594+ 
595+ 	         return Array._Vindex(self)
596+ 
597+       .. versionadded :: 8.3 
519598
520599.. rst :directive :: .. py:staticmethod:: name(parameters) 
521600                   .. py:staticmethod:: name[type parameters](parameters) 
0 commit comments