Return to Snippet

Revision: 29700
at August 4, 2010 00:09 by silviud


Initial Code
class Recurse:

    last_t = []

    def recurse(self,t):
        if not isinstance(t, tuple):
                self.last_t.append(t)
        else:
                for t1 in t:
                        self.recurse(t1)
        return tuple(self.last_t)



d = ((((1,2,3,'test'),),),)

print Recurse().recurse(d)

Initial URL


Initial Description
in case that you want to pass between multiple methods the same *args and unpack it
at the end

Initial Title
python recurse for *args

Initial Tags
python

Initial Language
Python