Stargaming wrote: > Either you take one of the snippets here: > http://aspn.activestate.com/ASPN/search?query=flatten§ion=PYTHONCKBK&type=Subsection > > > or just use arg[0] clever (as mentioned a few times in this thread).
Thanks. My solution became: >>> def flattern(arg): ... result = [] ... for item in arg: ... if isinstance(item, (list, tuple)): ... result.extend(flattern(item)) ... else: ... result.append(item) ... return tuple(result) ... >>> def g(*arg): ... arg = flattern(arg) ... return arg ... >>> def f(*arg): ... return g(arg) ... >>> f('foo', 'bar') ('foo', 'bar') TV -- http://mail.python.org/mailman/listinfo/python-list