Alan Isaac wrote:
The current situation is: use a loop because the obvious generator
approach is not efficient.
Fredrik Lundh [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
not efficient compared to what ?
I already guess that I've missed your point, but to prove it...
I was
George Young wrote:
...
I am puzzled that creating large dicts with an explicit iterable of
key,value pairs seems to be slow. I thought to save time by doing:
palettes = dict((w,set(w)) for w in words)
instead of:
palettes={}
for w in words:
palettes[w]=set(w)
In the
Does George's example raise the question:
why do dictionaries not implement efficient creation
for two common cases?
- Making a dict from two sequences of the same length.
- Making a dict from a sequence and a function
(as in George's example in this thread).
The current situation is:
use a
David Isaac wrote:
The current situation is: use a loop because the obvious generator
approach is not efficient.
not efficient compared to what ?
/F
--
http://mail.python.org/mailman/listinfo/python-list
David Isaac wrote:
Does George's example raise the question:
why do dictionaries not implement efficient creation
for two common cases?
- Making a dict from two sequences of the same length.
- Making a dict from a sequence and a function
(as in George's example in this thread).
Maybe
Fredrik Lundh wrote:
David Isaac wrote:
The current situation is: use a loop because the obvious generator
approach is not efficient.
not efficient compared to what ?
Compared to understanding what's actually going on and working with
reality as opposed to some superstitious view of
[Python 2.5c2 (r25c2:51859, Sep 17 2006, 19:57:40), sparc solaris]
I am puzzled that creating large dicts with an explicit iterable of
key,value pairs seems to be slow. I thought to save time by doing:
palettes = dict((w,set(w)) for w in words)
instead of:
palettes={}
for w in words:
George Young wrote:
I am puzzled that creating large dicts with an explicit iterable of
key,value pairs seems to be slow. I thought to save time by doing:
palettes = dict((w,set(w)) for w in words)
instead of:
palettes={}
for w in words:
palettes[w]=set(w)
where words