During learning Django framework basics I found the following piece of code. I know how does join()
method work but frankly speaking I have no idea what's inside.
output = ', '.join([p.question for p in latest_poll_list])
Of course the result is very clear to me, but I would rather use it this way
array = []
for p in latest_poll_list:
array.append(p.question)
output = ', '.join(array)
Can anyone explain?