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: > > myobj = myclass() > > doit(*myobj)
Make it iterable: >>> class Foo(object): ... def __iter__(self): ... yield 1 ... yield 2 ... yield 3 ... >>> def bar(*args): ... print args ... >>> bar(*Foo()) (1, 2, 3) > And, how about the "**something" operator? Use a dictionary. -- http://mail.python.org/mailman/listinfo/python-list