[Patches] [ python-Patches-1751800 ] Dict comprehensions
SourceForge.net
noreply at sourceforge.net
Wed Jul 11 13:46:17 CEST 2007
Patches item #1751800, was opened at 2007-07-11 10:49
Message generated for change (Comment added) made by gbrandl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1751800&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 3000
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Thomas Wouters (twouters)
Assigned to: Guido van Rossum (gvanrossum)
Summary: Dict comprehensions
Initial Comment:
Dict comprehensions, implemented somewhat like:
d = {}
for key, value in gen():
d[key] = value
A version that passes the generator directly to dict() might be faster (although it would have to generate tuples instead of two separate items on the stack, which may negate the benefit of doing the actual dict assignment in C) -- and of course the danger of passing the generator to a local or global 'dict' variable instead of the builtin 'dict'.
Includes tests, but not compiler-package or documentation changes (yet).
----------------------------------------------------------------------
>Comment By: Georg Brandl (gbrandl)
Date: 2007-07-11 11:46
Message:
Logged In: YES
user_id=849994
Originator: NO
I tested the patch shallowly, works fine. I think this is a good feature
to have, even if only for completeness.
The tests don't seem to be included.
compiler package changes won't be needed, as it has been removed from
Py3k,
but probably changes to parsermodule.c.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1751800&group_id=5470
More information about the Patches
mailing list