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

Hilbert hilbert at microsoft.com
Fri Mar 7 04:19:35 EST 2003


Ok.
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?

Thanks,
Hilbert






More information about the Python-list mailing list