I know that for creating lists you can shorten a few lines down to something like (in python):
a = [k*2 for k in range(10)]
Can you do this for when sending data through a pipe. (using multiprocessing module in this case). eg:
k = 'hello'
[channel.send(k) for channel in channels]
instead of:
k = 'hello'
for channel in channels:
channel.send(k)
Any suggestions would be great! Thanks in advance.
EDIT: Has been answered. List comprehensions bad idea. Just keep it neat to one line:
k = 'hello'
for channel in channels: channel.send(k)