I've been reading the following example, and couldn't figure out, what
**kw mean. (It's an empty dictionary, but what's the semantics):
def wrap(method):
def wrapped(self, *args, **kw):
print "begin"
method(self, *args, **kw)
print "end"
return wrapped
class Test(object):
def method(self, name):
print "method(%r) " % name
t = Test()
t.method("pure" )
Test.method = wrap(Test.metho d)
t.method("wrapp ed")
**kw mean. (It's an empty dictionary, but what's the semantics):
def wrap(method):
def wrapped(self, *args, **kw):
print "begin"
method(self, *args, **kw)
print "end"
return wrapped
class Test(object):
def method(self, name):
print "method(%r) " % name
t = Test()
t.method("pure" )
Test.method = wrap(Test.metho d)
t.method("wrapp ed")
Comment