mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
Patch #1759: Backport of PEP 3129 class decorators
with some help from Georg
This commit is contained in:
parent
b12f0b581a
commit
5224d28d38
15 changed files with 1591 additions and 1465 deletions
|
@ -779,6 +779,16 @@ hello world
|
|||
def meth1(self): pass
|
||||
def meth2(self, arg): pass
|
||||
def meth3(self, a1, a2): pass
|
||||
# decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE
|
||||
# decorators: decorator+
|
||||
# decorated: decorators (classdef | funcdef)
|
||||
def class_decorator(x):
|
||||
x.decorated = True
|
||||
return x
|
||||
@class_decorator
|
||||
class G:
|
||||
pass
|
||||
self.assertEqual(G.decorated, True)
|
||||
|
||||
def testListcomps(self):
|
||||
# list comprehension tests
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue