]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#17035: use new style classes in classmethod/staticmethod examples. Patch by Berker...
authorEzio Melotti <ezio.melotti@gmail.com>
Fri, 22 Feb 2013 05:34:52 +0000 (07:34 +0200)
committerEzio Melotti <ezio.melotti@gmail.com>
Fri, 22 Feb 2013 05:34:52 +0000 (07:34 +0200)
Doc/library/functions.rst

index ec3b1d67a29900662dcc429861c60096cb972bfc..34ef83146a2c5b7ba5b50f63eb4279a184c79e82 100644 (file)
@@ -162,9 +162,10 @@ available.  They are listed here in alphabetical order.
    instance method receives the instance. To declare a class method, use this
    idiom::
 
-      class C:
+      class C(object):
           @classmethod
-          def f(cls, arg1, arg2, ...): ...
+          def f(cls, arg1, arg2, ...):
+              ...
 
    The ``@classmethod`` form is a function :term:`decorator` -- see the description
    of function definitions in :ref:`function` for details.
@@ -1303,9 +1304,10 @@ available.  They are listed here in alphabetical order.
    A static method does not receive an implicit first argument. To declare a static
    method, use this idiom::
 
-      class C:
+      class C(object):
           @staticmethod
-          def f(arg1, arg2, ...): ...
+          def f(arg1, arg2, ...):
+              ...
 
    The ``@staticmethod`` form is a function :term:`decorator` -- see the
    description of function definitions in :ref:`function` for details.