Python: Regexp in list comprehension (shortcut syntax)
# Taken from Stack Overflow answer http://stackoverflow.com/a/2436623/4093021
import re
# items = ['[1] rymoio [rymoio 7s] foo bar', '[2] baz [rymoio 2d] hello world']
# assign matches to callable group parameters
regex = r"(?P<who>.*\[.*\]\s)(?P<what>.*)"
# bound method outside of the listcomp optimization
src = re.search
# assign matches to m within listcomp
items = [[m.group('who'), m.group('what')] for item in items for m in [src(regex, item)] if m]
# >>> [['[1] rymoio [rymoio 7s] ', 'foo bar'], ['[2] baz [rymoio 2d] ', 'hello world']]