class decorators with __call__ are now properly working

This commit is contained in:
David Halter
2012-06-12 17:02:24 +02:00
parent c1fc527d60
commit e1dbdc1662
3 changed files with 63 additions and 31 deletions

View File

@@ -183,9 +183,27 @@ class B():
def r(self):
return 1
@r.setter
def r(self, value):
pass
#@r.setter
#def r(self, value):
# pass
#? []
B().r.
#? []
B().r()
class Decorator(object):
def __init__(self, func):
self.func = func
def __call__(self, *args, **kwargs):
return self.func(1, *args, **kwargs)
@Decorator
def nothing(a,b,c):
return a,b,c
#? int()
nothing("")[0]
#? str()
nothing("")[1]