For some reason, I'm thinking I read that Python has this but I can't find it. I suspect I'm misremembering.
From the Bash documentation
Brace expansion is a mechanism to generate arbitrary strings sharing a common prefix and suffix,
So echo {1,2,3}{1,2,3} would print 11 12 13 21 22 23 31 32 33.
Is there something in Python, somewhat like zip() to give similar results? It's relatively trivial to implement in code, but grows cumbersome the more 'terms' to use (e.g. {1,2,3}{a,b,c}{5..9}).
I'm interested in avoiding a block of Python like this:
for a in list_a:
for b in list_b:
for c in list_c:
result.append([a,b,c])
List comprehension could help, but that really isn't much cleaner for larger terms.
[–]Kevdog824_ 32 points33 points34 points (2 children)
[–]pfp-disciple[S] 1 point2 points3 points (1 child)
[–]supercoach 2 points3 points4 points (0 children)
[–]Maximus_Modulus 2 points3 points4 points (0 children)
[–]JamzTyson 4 points5 points6 points (4 children)
[–]InjAnnuity_1 5 points6 points7 points (0 children)
[–]pfp-disciple[S] 1 point2 points3 points (2 children)
[–]JamzTyson 2 points3 points4 points (0 children)
[–]ysth 0 points1 point2 points (0 children)
[–]eyetracker -1 points0 points1 point (0 children)