Skip to content

Commit a57ec7a

Browse files
bpo-43698: do not use ... as argument name in docs (GH-30502)
(cherry picked from commit b9d8980) Co-authored-by: Nikita Sobolev <[email protected]>
1 parent 4371fbd commit a57ec7a

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

Doc/faq/design.rst

+8-11
Original file line numberDiff line numberDiff line change
@@ -266,27 +266,24 @@ For cases where you need to choose from a very large number of possibilities,
266266
you can create a dictionary mapping case values to functions to call. For
267267
example::
268268

269-
def function_1(...):
270-
...
271-
272269
functions = {'a': function_1,
273270
'b': function_2,
274-
'c': self.method_1, ...}
271+
'c': self.method_1}
275272

276273
func = functions[value]
277274
func()
278275

279276
For calling methods on objects, you can simplify yet further by using the
280277
:func:`getattr` built-in to retrieve methods with a particular name::
281278

282-
def visit_a(self, ...):
283-
...
284-
...
279+
class MyVisitor:
280+
def visit_a(self):
281+
...
285282

286-
def dispatch(self, value):
287-
method_name = 'visit_' + str(value)
288-
method = getattr(self, method_name)
289-
method()
283+
def dispatch(self, value):
284+
method_name = 'visit_' + str(value)
285+
method = getattr(self, method_name)
286+
method()
290287

291288
It's suggested that you use a prefix for the method names, such as ``visit_`` in
292289
this example. Without such a prefix, if values are coming from an untrusted

Doc/glossary.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,12 @@ Glossary
292292
The decorator syntax is merely syntactic sugar, the following two
293293
function definitions are semantically equivalent::
294294

295-
def f(...):
295+
def f(arg):
296296
...
297297
f = staticmethod(f)
298298

299299
@staticmethod
300-
def f(...):
300+
def f(arg):
301301
...
302302

303303
The same concept exists for classes, but is less commonly used there. See

Doc/library/abc.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,15 @@ The :mod:`abc` module also provides the following decorator:
186186

187187
class C(ABC):
188188
@abstractmethod
189-
def my_abstract_method(self, ...):
189+
def my_abstract_method(self, arg1):
190190
...
191191
@classmethod
192192
@abstractmethod
193-
def my_abstract_classmethod(cls, ...):
193+
def my_abstract_classmethod(cls, arg2):
194194
...
195195
@staticmethod
196196
@abstractmethod
197-
def my_abstract_staticmethod(...):
197+
def my_abstract_staticmethod(arg3):
198198
...
199199

200200
@property
@@ -255,7 +255,7 @@ The :mod:`abc` module also supports the following legacy decorators:
255255
class C(ABC):
256256
@classmethod
257257
@abstractmethod
258-
def my_abstract_classmethod(cls, ...):
258+
def my_abstract_classmethod(cls, arg):
259259
...
260260

261261

@@ -276,7 +276,7 @@ The :mod:`abc` module also supports the following legacy decorators:
276276
class C(ABC):
277277
@staticmethod
278278
@abstractmethod
279-
def my_abstract_staticmethod(...):
279+
def my_abstract_staticmethod(arg):
280280
...
281281

282282

Doc/library/functions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ are always available. They are listed here in alphabetical order.
248248

249249
class C:
250250
@classmethod
251-
def f(cls, arg1, arg2, ...): ...
251+
def f(cls, arg1, arg2): ...
252252

253253
The ``@classmethod`` form is a function :term:`decorator` -- see
254254
:ref:`function` for details.

0 commit comments

Comments
 (0)