Raymond Hettinger wrote:
> Since I expect students to be among the users for the comb/perm
> functions, there is some merit to keeping the API as simple as possible.
> Besides, it is not hard to use the existing tool as a primitive to get to
> the one you want:
>
> def mycombinations(iterable, r_seq):
> # mycombinations('abc', [1,2]) --> A B C AB AC BC
> iterable = list(iterable)
> return chain.from_iterable(imap(combinations, repeat(iterable),
> r_seq))
Perhaps a reasonable starting point would be to include this as one of
the example itertools recipes in the documentation?
Cheers,
Nick.
--
Nick Coghlan | [email protected] | Brisbane, Australia
---------------------------------------------------------------
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com