Non Continuous Subsequences

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Thu Jul 31 13:43:11 EDT 2008


Bruce Frederiksen:

Your solution is a bit different from what I was thinking about (I was
thinking about a generator function, with yield), but it works.

This line:
>         return itertools.chain(
>                    itertools.imap(lambda ys: x + ys, ncsub(xs, s + p1)),
>                    ncsub(xs, s + p2))

Can be written in a simpler way:
return chain((x + ys for ys in ncsub(xs, s + p1)), ncsub(xs, s + p2))

I'll think more about all this,
bye and thank you,
bearophile



More information about the Python-list mailing list