Dave Cook wrote:
> On 2005-06-24, infidel <[EMAIL PROTECTED]> wrote:
> 
> 
>>dict((x, None) for x in alist)
> 
> Whoa, I thought dictionary comprehensions were still planned feature.  I
> guess I gotta start paying closer attention.

Added in Python 2.4, it's actually a generator expression as the sole 
argument to a generic dict() constructor.  Think of the generator 
expression as sort of like the list comprehension that it resembles, 
minus the square brackets, but which doesn't have to create the entire 
list before the dict() constructor starts to consume the elements.

-Peter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to