Paul Rubin wrote:
[snip]
> 
>     def a(n):
>         if n==0:
>             yield ''
>             return
>         for c in s:
>             for r in a(n-1):
>                 yield c+r
> 
>     print list(a(3))

Of course, obvious in retrospect, recursion instead of iteration.
I have yet to completely wean myself off Fortran style thinking.

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

Reply via email to