This below snippet of code gives me this error TypeError: pop() argument after ** must be a mapping, not tuple
.
class a():
data={'a':'aaa','b':'bbb','c':'ccc'}
def pop(self, key, **args):
return self.data.pop(key, **args)
b=a()
print(b.pop('a',{'b':'bbb'}))
But when I replace double **
with single *
, this works fine. As per my understanding , if we are passing a dictionary , we should have double **
. In this case the second argument what's being passed is dictionary {'b':'bbb'}
. Then how is it throwing error in first case but not in second case?
class a():
data={'a':'aaa','b':'bbb','c':'ccc'}
def pop(self, key, *args):
return self.data.pop(key, *args)
b=a()
print(b.pop('a',{'b':'bbb'})