(seq, length)
| 11 | return ret |
| 12 | |
| 13 | def combination(seq, length): |
| 14 | if not length: |
| 15 | yield [] |
| 16 | else: |
| 17 | for i in xrange(len(seq)): |
| 18 | for result in combination(seq[i+1:], length-1): |
| 19 | yield [seq[i]] + result |
| 20 | |
| 21 | def charat(key, idx): |
| 22 | if idx >= len(key): |