[Patches] [ python-Patches-642500 ] Allow keyword args in dict() constructor
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 22 Nov 2002 12:29:39 -0800
Patches item #642500, was opened at 2002-11-22 21:11
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=642500&group_id=5470
Category: Core (C code)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Just van Rossum (jvr)
Assigned to: Raymond Hettinger (rhettinger)
Summary: Allow keyword args in dict() constructor
Initial Comment:
I sometimes use an idiom like
def dictfromkeywords(**kwargs):
return kwargs
d = dictfromkeywords(
akey = 12,
anotherkey = "foo",
...etc.
)
to conveniently build dicts with literal keys. This
patch adds this behavior to the dict constructor so one
can write:
dict(one=1, two=2)
The patch patches Doc/lib/libfuncs.text,
Objects/dictobject.c, Lib/test/test_descr.py and Misc/NEWS
The dictobject.c patch contains an XXX comment about
something I'm not 100% sure about. Please review.
Thanks to Raymond H. for earlier comments.
----------------------------------------------------------------------
>Comment By: Just van Rossum (jvr)
Date: 2002-11-22 21:29
Message:
Logged In: YES
user_id=92689
Oops, the doctobject.c *doesn't* contain an XXX comment, I
was thinking of an earlier version of the patch. As far as I
can see the patch is fine as is (although Fred may want to
double check the libfuncs.tex patch).
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=642500&group_id=5470