[Python-checkins] cpython (2.7): #17035: use new style classes in classmethod/staticmethod examples. Patch by
ezio.melotti
python-checkins at python.org
Fri Feb 22 06:53:39 CET 2013
http://hg.python.org/cpython/rev/30e7bc28d4f5
changeset: 82312:30e7bc28d4f5
branch: 2.7
parent: 82308:f4ccc5aab287
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Fri Feb 22 07:34:52 2013 +0200
summary:
#17035: use new style classes in classmethod/staticmethod examples. Patch by Berker Peksag.
files:
Doc/library/functions.rst | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -162,9 +162,10 @@
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 @@
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.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list