[New-bugs-announce] [issue5048] Extending itertools.combinations

Konrad report at bugs.python.org
Sun Jan 25 03:05:04 CET 2009

New submission from Konrad <konryd at gmail.com>:

The function itertools.combinations might benefit from making
the 'r' (length of the combinations) argument optionally a sequence.

With that change one could call combinations(sequence, [2, 3]) in
order to get all combinations of length 2 and 3.
In particular, one could call combinations(sequence,
range(len(sequence)) in order to get *all* combinations of given

The change would be backwards compatible as it would check for
sequential arguments.

components: Library (Lib)
messages: 80492
nosy: konryd, rhettinger
severity: normal
status: open
title: Extending itertools.combinations
type: feature request

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list