On Mon, Jun 7, 2010 at 4:03 PM, Peter Otten <__pete...@web.de> wrote: > The following experiment shows that you only need to implement a keys() and > __getitem__() method. > > $ cat kw.py > class A(object): > def keys(self): return list("ab") > def __getitem__(self, key): > return 42 > > def f(**kw): > print(kw) > > f(**A()) > $ python kw.py > {'a': 42, 'b': 42}
This seems to require Python 2.6. With 2.5, you get: Traceback (most recent call last): File "kw.py", line 9, in <module> f(**A()) TypeError: f() argument after ** must be a dictionary Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list