c = {x: '' for x in a}

Hilbert hilbert at microsoft.com
Fri Mar 7 10:19:35 CET 2003

This works:

a = [1,2,3]
b = [x for x in a]

What's wrong with this one though? It would totally make sense to me...

a = [1,2,3]
c = {x: '' for x in a}

Where can I find documentation about "[x for x in a]"? What is it called?


More information about the Python-list mailing list