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())