Most efficient solution?

Terry Reedy tjreedy at
Mon Jul 16 13:11:10 EDT 2001

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

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

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

More information about the Python-list mailing list