"Peter Otten" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> A non-recursive approach:
>
> def enumerate_ex(items):
>     stack = [(enumerate(items), items)]
>     while stack:
>         en, seq = stack[-1]
>         for index, item in en:
>             if isinstance(item, list):
>                 stack.append((enumerate(item), item))
>                 break
>             yield index, seq[index], seq
>         else:
>             stack.pop()

It's going to take me a while to figure out exactly what that does but it
sure does what I wanted it to.
Thanks.

-- 
Donald Newcomb
DRNewcomb (at) attglobal (dot) net


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to