/ Published in: Python
in case that you want to pass between multiple methods the same *args and unpack it at the end
Expand |
Embed | Plain Text
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)
Comments
Subscribe to comments
You need to login to post a comment.

in case that you want to use the regular python way send the args unpacked as
callfoo(*argsunpacked)