On Monday 07 November 2005 20:36, Alex Martelli wrote: > Ron Adam <[EMAIL PROTECTED]> wrote: > > James Stroud wrote: > > > Hello All, > > > > > > How does one make an arbitrary class (e.g. class myclass(object)) > > > behave like a list in method calls with the "*something" operator? What > > > I mean is: [snip] > > A dictionary would be pretty much the same except subclassed from a > > dictionary of course. > > I believe this one is correct (but I have not checked in-depth!).
Does anyone else find the following annoying: py> from UserDict import UserDict py> aud = UserDict({"a":1, "b":2}) py> def doit(**kwargs): ... print kwargs ... py> aud {'a': 1, 'b': 2} py> doit(**aud) Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: doit() argument after ** must be a dictionary UserDict should be isomorphic with a dict. The fact that it is not in this case seems terribly un-pythonic to me. -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list