Skip to content

Instantly share code, notes, and snippets.

@ionelmc
Created June 6, 2013 19:12
Show Gist options
  • Select an option

  • Save ionelmc/5724083 to your computer and use it in GitHub Desktop.

Select an option

Save ionelmc/5724083 to your computer and use it in GitHub Desktop.
>>> import itertools
>>> [
... 'queue_%s' % '_'.join(str(node) for node in combination)
... for combination in itertools.chain(*[
... itertools.combinations(range(4), i) for i in range(1, 5)
... ])
... ]
['queue_0', 'queue_1', 'queue_2', 'queue_3', 'queue_0_1', 'queue_0_2', 'queue_0_3', 'queue_1_2', 'queue_1_3', 'queue_2_3', 'queue_0_1_2', 'queue_0_1_3', 'queue_0_2_3', 'queue_1_2_3', 'queue_0_1_2_3']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment