Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save chapmanjacobd/b0552469df94bf46c04bf6b4b5144964 to your computer and use it in GitHub Desktop.
import itertools
subcommand_abbrevs = []
def consequtive_combos(s):
combos=[list(itertools.combinations(s,x)) for x in range(1,len(s))]
combos=set([''.join(e) for e in sum(combos,[]) if e[0] == s[0] and ''.join(e) not in subcommand_abbrevs])
subcommand_abbrevs.extend(combos)
return combos
q=consequtive_combos('merge-online-local')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment