nice and concise, found on comp.lang.python:

def flatten(a):
   if not isinstance(a,(tuple,list)): return [a]
   if len(a)==0: return []
   return flatten(a[0])+flatten(a[1:])

_________________________________________________________________
Play online games with your friends with MSN Messenger http://messenger.msn.nl/


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to