[Patches] [ python-Patches-643443 ] dict.sequpdate()
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 25 Nov 2002 16:38:32 -0800
Patches item #643443, was opened at 2002-11-25 05:29
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=643443&group_id=5470
Category: Core (C code)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Raymond Hettinger (rhettinger)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: dict.sequpdate()
Initial Comment:
Implements dict.sequpdate() as discussed on python-
dev:
def sequpdate(self, iterable, value=True):
for k in iterable:
self[k] = value
return self
----------------------------------------------------------------------
>Comment By: Raymond Hettinger (rhettinger)
Date: 2002-11-25 19:38
Message:
Logged In: YES
user_id=80475
Attached revised patch incorporating all of the review
comments. Changed default to None. Made a static
method instead of a classmethod because cls was not
used. Doesn't return self.
Tests, docs, and news item revised accordingly.
Ready for BDFL pronouncement.
----------------------------------------------------------------------
Comment By: Just van Rossum (jvr)
Date: 2002-11-25 09:26
Message:
Logged In: YES
user_id=92689
One more thing: I'd say the default value should be None.
This makes the idiom also useful to initialize dicts which
later get filled with proper values. This doesn't take
anything away from your original use case.
----------------------------------------------------------------------
Comment By: Just van Rossum (jvr)
Date: 2002-11-25 09:09
Message:
Logged In: YES
user_id=92689
I see no reason why d.sequpdate() should return self.
d.update() doesn't either.
Also, as I suggested on python-dev, a fromseq() constructor
(as a class method) would be nice:
>>> dict.fromseq('End Quit Stop Abort'.split())
{'End': True, 'Quit': True, 'Stop': True, 'Abort': True}
>>>
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=643443&group_id=5470