fun_calldblstar3.py 389 B

1234567891011121314151617
  1. # test passing a user-defined mapping as the argument to **
  2. def foo(**kw):
  3. print(sorted(kw.items()))
  4. class Mapping:
  5. def keys(self):
  6. # the long string checks the case of string interning
  7. return ['a', 'b', 'c', 'abcdefghijklmnopqrst']
  8. def __getitem__(self, key):
  9. if key == 'a':
  10. return 1
  11. else:
  12. return 2
  13. foo(**Mapping())