Suppose such a dict with multiple items:
d = {'foo':['c', 'a', 't'], 'bar':['d', 'o', 'g']}
I'd like to produce
l = ['c', 'a', 't', 'd', 'o', 'g']
In [75]: l = []
...: for i in d.values():
...: l.extend(i)
...: print(l)
['c', 'a', 't', 'd', 'o', 'g']
Try to implement it within one line using extend method.
In [76]: [ [].extend(i) for i in d.values() ]
Out[76]: [None, None]
In [79]: [ list().extend(i) for i in d.values()]
Out[79]: [None, None]
What's the principles behind list comprehension to output [None, None] ?
It's facile to be achieved by
In [78]: [i for j in d.values() for i in j]
Out[78]: ['c', 'a', 't', 'd', 'o', 'g']
Is it possible to be done with extend methond in single line?