diff options
author | Guido van Rossum <guido@python.org> | 2005-01-16 00:25:31 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2005-01-16 00:25:31 (GMT) |
commit | 5a8a03784e56e5931b4cdb3946494f8d15c72bd2 (patch) | |
tree | 9dcce6980365a3642c0a1c80d731586407af9346 /Lib/test/test_descrtut.py | |
parent | fee7b93c60310413db31973c13e5abb4c7620ef4 (diff) | |
download | cpython-5a8a03784e56e5931b4cdb3946494f8d15c72bd2.zip cpython-5a8a03784e56e5931b4cdb3946494f8d15c72bd2.tar.gz cpython-5a8a03784e56e5931b4cdb3946494f8d15c72bd2.tar.bz2 |
Use descriptors.
Diffstat (limited to 'Lib/test/test_descrtut.py')
-rw-r--r-- | Lib/test/test_descrtut.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_descrtut.py b/Lib/test/test_descrtut.py index 851ce4a..9dcfca1 100644 --- a/Lib/test/test_descrtut.py +++ b/Lib/test/test_descrtut.py @@ -246,9 +246,9 @@ static methods in C++ or Java. Here's an example: >>> class C: ... + ... @staticmethod ... def foo(x, y): ... print "staticmethod", x, y - ... foo = staticmethod(foo) >>> C.foo(1, 2) staticmethod 1 2 @@ -260,9 +260,9 @@ Class methods use a similar pattern to declare methods that receive an implicit first argument that is the *class* for which they are invoked. >>> class C: + ... @classmethod ... def foo(cls, y): ... print "classmethod", cls, y - ... foo = classmethod(foo) >>> C.foo(1) classmethod test.test_descrtut.C 1 @@ -286,10 +286,10 @@ call, not the class involved in the definition of foo(). But notice this: >>> class E(C): + ... @classmethod ... def foo(cls, y): # override C.foo ... print "E.foo() called" ... C.foo(y) - ... foo = classmethod(foo) >>> E.foo(1) E.foo() called |