
Feb. 1, 2007
8:16 p.m.
George Sakkis wrote:
I think the dict constructor is already a bit too complicated, and would prefer that it be a separate classmethod, such as dict.zip(keys, values=itertools.repeat(None)) The default argument on values should finish the replacement of dict.fromkeys functionality that sets and defaultdicts began.
At least as efficient as the current alternatives.
I think it has to do better (at least by eliminating the temporary zip object) to be worthwhile; the do-it-yourself alternative is pretty short. >>> # from itertools import izip as zip >>> def dictz(keys, values): return dict(zip(keys,values)) -jJ
6619
Age (days ago)
6619
Last active (days ago)
0 comments
1 participants
participants (1)
-
Jim Jewett