In Python, if you have a dictionary that consists of lists like
mydict = {'foo': [], 'bar':[3, 4]}
and if you want to add something to these lists, you can do
mydict.setdefault('baz', []).append(5)
don't write
key, list_element = 'baz', 5 if key in mydict: mydict[key].append(list_element) else: mydict[key] = [list_element]
is there an equivalent for this in coffeescript?
source share