I'm trying to figure out what this code does:
printdead, printlive = '_#'
It's from here, a site with implementations of elementary cellular automata: https://rosettacode.org/wiki/One-dimensional_cellular_automata#Python
Apparently I can replace the above statement by simply writing
printdead = '_'
printlive = '#'
printdead = '_'; printlive = '#'
printdead, printlive = '_', '#'
which is all perfectly fine by me. But how does the first statement work?
strcan be treated as a sequence and is unpacked.'_##'would have resulted in an error. The same happens withfor char in string:.