Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #2997

Re: [Feature Request] dict.setdefault()

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!news2.arglkargh.de!news.wiretrip.org!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:: [': 0.03; 'args': 0.07; 'imho.': 0.09; 'overwrite': 0.09; 'subject:()': 0.09; 'am,': 0.14; 'wrote:': 0.14; '(key': 0.16; 'mrab': 0.16; 'argument': 0.16; 'subject:] ': 0.16; 'subject:skip:d 10': 0.18; "wouldn't": 0.18; 'tue,': 0.20; 'header:In-Reply-To:1': 0.22; 'optional': 0.23; 'values.': 0.23; 'structure': 0.24; "i'm": 0.26; 'chris': 0.27; 'message-id:@mail.gmail.com': 0.28; 'to:addr :python-list': 0.32; 'skip:" 10': 0.34; 'should': 0.37; 'received:209.85': 0.37; 'apr': 0.38; 'received:google.com': 0.38; 'pretty': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'except': 0.39; 'would': 0.40; 'header:Received:5': 0.40; 'act': 0.61; '2011': 0.62; 'subject:Request': 0.73; 'received:209.85.210.174': 0.84; 'received:mail- iy0-f174.google.com': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=+nijsm5zpLBtyD7T81MSijVAKtwzBN+6cDt83wMQErc=; b=M4nuYy4qDwujBU9cfOy1G6wRQEmixLo/VgHxdurMK6+4Q9hexl86fNPlCghBcKkT66 UV5br04PNuZfkq6LImMChQtgYBJYk4u8AYZSu/Twe8cW19r7fJfemHywXIt14lk9A2Eh f44I1fOH2PiiZwqjkHRaW1496YJ62JkvWEUP8=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=ihpAOKv/4MGSym+QcyA7dKJuLdk0nc3R4oNKNOTHu5zfEMM5Z4/9wU4TTPeaIl50vF 9WBg117Jw359Ba3j69mhiQ7WbmKg7w4CFSe70nWIcYbhtb2XmDVyCfCZnMS3/btzcA5D 3GwQOts9zFEIqk8cps/cmJuCQGJHiqM9eucfc=
MIME-Version 1.0
In-Reply-To <4DA38391.1040507@mrabarnett.plus.com>
References <48897e75-c02c-43c7-9f46-39da4bcc406d@p16g2000vbi.googlegroups.com> <1302560207.11756.1.camel@localhost.localdomain> <4DA38391.1040507@mrabarnett.plus.com>
Date Tue, 12 Apr 2011 08:44:53 +1000
Subject Re: [Feature Request] dict.setdefault()
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.226.1302561897.9059.python-list@python.org> (permalink)
Lines 10
NNTP-Posting-Host 82.94.164.166
X-Trace 1302561897 news.xs4all.nl 81475 [::ffff:82.94.164.166]:48187
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:2997

Show key headers only | View raw


On Tue, Apr 12, 2011 at 8:41 AM, MRAB <python@mrabarnett.plus.com> wrote:
> I'm not sure that "setdefault" should take **kw args for this because
> of its existing argument structure (key + optional value).
>
> A new method like "updatedefault" may be better, IMHO. It would act
> like "update" except that it wouldn't overwrite existing values.

Wouldn't x.updatedefault(y) be pretty much y.update(x) ?

Chris Angelico

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

[Feature Request] dict.setdefault() rantingrick <rantingrick@gmail.com> - 2011-04-11 14:35 -0700
  Re: [Feature Request] dict.setdefault() Westley Martínez <anikom15@gmail.com> - 2011-04-11 15:16 -0700
  Re: [Feature Request] dict.setdefault() MRAB <python@mrabarnett.plus.com> - 2011-04-11 23:41 +0100
    Re: dict.setdefault() rantingrick <rantingrick@gmail.com> - 2011-04-11 19:58 -0700
      Re: dict.setdefault() Westley Martínez <anikom15@gmail.com> - 2011-04-12 07:02 -0700
  Re: [Feature Request] dict.setdefault() Chris Angelico <rosuav@gmail.com> - 2011-04-12 08:44 +1000
  Re: dict.setdefault() Raymond Hettinger <python@rcn.com> - 2011-04-11 15:49 -0700
  Re: [Feature Request] dict.setdefault() Chris Rebert <clp2@rebertia.com> - 2011-04-11 15:53 -0700
  Re: [Feature Request] dict.setdefault() MRAB <python@mrabarnett.plus.com> - 2011-04-11 23:59 +0100
  Re: [Feature Request] dict.setdefault() Tim Chase <python.list@tim.thechases.com> - 2011-04-11 18:25 -0500
    Re: dict.setdefault() Raymond Hettinger <python@rcn.com> - 2011-04-11 17:17 -0700

csiph-web