Most efficient solution?

Terry Reedy tjreedy at home.com
Mon Jul 16 19:11:10 CEST 2001


> C = {}
> for item in B:
>     C[item]=None

This sort of makes me wish we had dict comprehensions to match list
comprehensions:

C = {item:None for item in B}
or
C = {item:1  for item in B}
as revised and then discarded







More information about the Python-list mailing list