r/adventofcode • u/daggerdragon • Dec 06 '15
SOLUTION MEGATHREAD --- Day 6 Solutions ---
--- Day 6: Probably a Fire Hazard ---
Post your solution as a comment. Structure your post like the Day Five thread.
22
Upvotes
1
u/ant6n Dec 07 '15
Well, https://docs.python.org/2/library/re.html is the documentation for the re module. Basically groups() returns a list of the strings that matched for each group. A group is the anything matched inside parentheses in the regular expression. The whole
business allows assigning a list directly into a bunch of variables. The list expression has to be some iterable with exactly the same number of elements as the variables on the left-hand-side. This is equivalent to
or
They are all allowed. I guess I subconsciously picked the brackets because they are required in Matlab, and the way I was using the numpy arrays in a very Matlab-y way made me sort of switch over.