R
Ravi
The following code didn't work:
class X(object):
def f(self, **kwds):
print kwds
try:
print kwds['i'] * 2
except KeyError:
print "unknown keyword argument"
self.g("string", **kwds)
def g(self, s, kwds):
print s
print kwds
if __name__ == "__main__":
x = X()
x.f(k = 2, j = 10)
However the following did:
class X(object):
def f(self, **kwds):
print kwds
try:
print kwds['i'] * 2
except KeyError:
print "unknown keyword argument"
self.g("string", **kwds)
def g(self, s, **kwds):
print s
print kwds
if __name__ == "__main__":
x = X()
x.f(k = 2, j = 10)
Please explain
class X(object):
def f(self, **kwds):
print kwds
try:
print kwds['i'] * 2
except KeyError:
print "unknown keyword argument"
self.g("string", **kwds)
def g(self, s, kwds):
print s
print kwds
if __name__ == "__main__":
x = X()
x.f(k = 2, j = 10)
However the following did:
class X(object):
def f(self, **kwds):
print kwds
try:
print kwds['i'] * 2
except KeyError:
print "unknown keyword argument"
self.g("string", **kwds)
def g(self, s, **kwds):
print s
print kwds
if __name__ == "__main__":
x = X()
x.f(k = 2, j = 10)
Please explain