Skip to content

Commit 105ccc7

Browse files
miss-islingtonsobolevn
authored andcommitted
bpo-43698: do not use ... as argument name in docs (pythonGH-30502)
(cherry picked from commit b9d8980) Co-authored-by: Nikita Sobolev <[email protected]>
1 parent 7f6b25f commit 105ccc7

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

Doc/faq/design.rst

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

270-
def function_1(...):
271-
...
272-
273270
functions = {'a': function_1,
274271
'b': function_2,
275-
'c': self.method_1, ...}
272+
'c': self.method_1}
276273

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

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

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

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

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

Doc/glossary.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,12 @@ Glossary
278278
The decorator syntax is merely syntactic sugar, the following two
279279
function definitions are semantically equivalent::
280280

281-
def f(...):
281+
def f(arg):
282282
...
283283
f = staticmethod(f)
284284

285285
@staticmethod
286-
def f(...):
286+
def f(arg):
287287
...
288288

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

Doc/library/abc.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,15 @@ The :mod:`abc` module also provides the following decorator:
185185

186186
class C(ABC):
187187
@abstractmethod
188-
def my_abstract_method(self, ...):
188+
def my_abstract_method(self, arg1):
189189
...
190190
@classmethod
191191
@abstractmethod
192-
def my_abstract_classmethod(cls, ...):
192+
def my_abstract_classmethod(cls, arg2):
193193
...
194194
@staticmethod
195195
@abstractmethod
196-
def my_abstract_staticmethod(...):
196+
def my_abstract_staticmethod(arg3):
197197
...
198198

199199
@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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ are always available. They are listed here in alphabetical order.
210210

211211
class C:
212212
@classmethod
213-
def f(cls, arg1, arg2, ...): ...
213+
def f(cls, arg1, arg2): ...
214214

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

0 commit comments

Comments
 (0)