summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/fun_calldblstar3.py
blob: 4367e68df7b5b1f697919fa1cebf56c8526e5218 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# test passing a user-defined mapping as the argument to **

def foo(**kw):
    print(sorted(kw.items()))

class Mapping:
    def keys(self):
        return ['a', 'b', 'c']

    def __getitem__(self, key):
        if key == 'a':
            return 1
        else:
            return 2

foo(**Mapping())