[Patches] [ python-Patches-904720 ] dict.update should take a 2-tuple sequence like dict.__init_

SourceForge.net noreply at sourceforge.net
Thu Feb 26 20:28:03 EST 2004


Patches item #904720, was opened at 2004-02-25 20:05
Message generated for change (Comment added) made by gvanrossum
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=904720&group_id=5470

Category: Core (C code)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Bob Ippolito (etrepum)
Assigned to: Guido van Rossum (gvanrossum)
Summary: dict.update should take a 2-tuple sequence like dict.__init_

Initial Comment:
This patch allows:
    d = {}
    d.update([(1,2), (3,4)])

The current way to do it is (unfortunately):
    d = {}
    d.update(dict([(1,2), (3,4)]))

----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2004-02-26 20:28

Message:
Logged In: YES 
user_id=6380

-1 here

----------------------------------------------------------------------

Comment By: Bob Ippolito (etrepum)
Date: 2004-02-26 20:02

Message:
Logged In: YES 
user_id=139309

The (__doc__) documentation doesn't cover that case.. it says "new..." 
for every signature of dict.__init__.

Attempting to call __init__ multiple times isn't really an obvious thing to 
do, because it almost never does what you want.  I would chalk that up 
to an implementation detail of dict, not intended behavior :)

----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2004-02-26 19:53

Message:
Logged In: YES 
user_id=80475

Though not exactly obvious, this functionality and more is
available through dict.__init__().

Since it would be a change to an important API, referring to
Guido for pronouncement.  My vote is -0.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=904720&group_id=5470



More information about the Patches mailing list