]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43698: do not use `...` as argument name in docs (GH-30502)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 26 Jan 2022 12:42:39 +0000 (04:42 -0800)
committerGitHub <noreply@github.com>
Wed, 26 Jan 2022 12:42:39 +0000 (04:42 -0800)
(cherry picked from commit b9d8980d89bfaa4bf16d60f0488adcc9d2cbf5ef)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Doc/faq/design.rst
Doc/glossary.rst
Doc/library/abc.rst
Doc/library/functions.rst

index d0aee4e6072686169c0565d4721fafbcccd182bd..01fa5c77d86596126eb6d5c10f3d89315cd5fa45 100644 (file)
@@ -267,12 +267,9 @@ For cases where you need to choose from a very large number of possibilities,
 you can create a dictionary mapping case values to functions to call.  For
 example::
 
-   def function_1(...):
-       ...
-
    functions = {'a': function_1,
                 'b': function_2,
-                'c': self.method_1, ...}
+                'c': self.method_1}
 
    func = functions[value]
    func()
@@ -280,14 +277,14 @@ example::
 For calling methods on objects, you can simplify yet further by using the
 :func:`getattr` built-in to retrieve methods with a particular name::
 
-   def visit_a(self, ...):
-       ...
-   ...
+   class MyVisitor:
+       def visit_a(self):
+           ...
 
-   def dispatch(self, value):
-       method_name = 'visit_' + str(value)
-       method = getattr(self, method_name)
-       method()
+       def dispatch(self, value):
+           method_name = 'visit_' + str(value)
+           method = getattr(self, method_name)
+           method()
 
 It's suggested that you use a prefix for the method names, such as ``visit_`` in
 this example.  Without such a prefix, if values are coming from an untrusted
index da9dc9ceebfc4b55073e404f81a7936d6387bff0..f759c3fb056077db5a90a87e9306c872f53f160f 100644 (file)
@@ -278,12 +278,12 @@ Glossary
       The decorator syntax is merely syntactic sugar, the following two
       function definitions are semantically equivalent::
 
-         def f(...):
+         def f(arg):
              ...
          f = staticmethod(f)
 
          @staticmethod
-         def f(...):
+         def f(arg):
              ...
 
       The same concept exists for classes, but is less commonly used there.  See
index 424ae547d829a4cb1dcccfc88418410ba3495e5c..35be01e891e9da3f0ac2a7059a973729c4719302 100644 (file)
@@ -185,15 +185,15 @@ The :mod:`abc` module also provides the following decorator:
 
       class C(ABC):
           @abstractmethod
-          def my_abstract_method(self, ...):
+          def my_abstract_method(self, arg1):
               ...
           @classmethod
           @abstractmethod
-          def my_abstract_classmethod(cls, ...):
+          def my_abstract_classmethod(cls, arg2):
               ...
           @staticmethod
           @abstractmethod
-          def my_abstract_staticmethod(...):
+          def my_abstract_staticmethod(arg3):
               ...
 
           @property
@@ -255,7 +255,7 @@ The :mod:`abc` module also supports the following legacy decorators:
       class C(ABC):
           @classmethod
           @abstractmethod
-          def my_abstract_classmethod(cls, ...):
+          def my_abstract_classmethod(cls, arg):
               ...
 
 
@@ -276,7 +276,7 @@ The :mod:`abc` module also supports the following legacy decorators:
       class C(ABC):
           @staticmethod
           @abstractmethod
-          def my_abstract_staticmethod(...):
+          def my_abstract_staticmethod(arg):
               ...
 
 
index 8df557e47a16e13e8bea97d9df99e4841c7c634c..9a9c707dc177a9c6decc669a7f9a3434e8d5f44f 100644 (file)
@@ -210,7 +210,7 @@ are always available.  They are listed here in alphabetical order.
 
       class C:
           @classmethod
-          def f(cls, arg1, arg2, ...): ...
+          def f(cls, arg1, arg2): ...
 
    The ``@classmethod`` form is a function :term:`decorator` -- see
    :ref:`function` for details.