Skip to content

Commit b9d8980

Browse files
authored
bpo-43698: do not use ... as argument name in docs (GH-30502)
1 parent 84f0939 commit b9d8980

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

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

285-
def f(...):
285+
def f(arg):
286286
...
287287
f = staticmethod(f)
288288

289289
@staticmethod
290-
def f(...):
290+
def f(arg):
291291
...
292292

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

Lines changed: 1 addition & 1 deletion
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)