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

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

class Mapping:
    def keys(self):
        # the long string checks the case of string interning
        return ['a', 'b', 'c', 'abcdefghijklmnopqrst']

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

foo(**Mapping())