Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102673
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Random832 <random832@fastmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Set Operations on Dicts |
| Date | Mon, 08 Feb 2016 09:52:43 -0500 |
| Lines | 11 |
| Message-ID | <mailman.98.1454943165.2317.python-list@python.org> (permalink) |
| References | <mailman.86.1454925476.2317.python-list@python.org> <lf5fux3xuov.fsf@ling.helsinki.fi> <CAG93HwH72zLDm-fnnzAuKUSqTqPF3YesX_m5pE8YHQUqbAe+xA@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de BTLN3naQlWn9z2WMPf98tgM9gNz3wWIN/ENRl5hAPELQ== |
| Return-Path | <random832@fastmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.008 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'received:internal': 0.09; 'python': 0.10; '12:17,': 0.16; '2016': 0.16; 'e))': 0.16; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'feb': 0.23; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'express': 0.35; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'received:66': 0.38; 'to:addr:python.org': 0.40; 'header:Message-Id:1': 0.61; 'union': 0.67; 'subject:Set': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=V1ZdBlMvZnNR07sV5NnFYklU3D8=; b=1Wk67B UyN1Ch1qwDNoiWAHgS2gYtSHjBm8S7eX/UndVEFoyyscuUDKQwkXVx8REBtDEDrA c29Nsf9BeMWrdcGw65xAH1y6jlfojuLmas1wiMhxFleWnzv+IasSAnQwin9g/wXN LiSLg24PxV3TRY2QwTHW1W/eEeOXLBFglBy8g= |
| DKIM-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=V1ZdBlMvZnNR07s V5NnFYklU3D8=; b=T2YXK7P1gm99gpPpVDVolgsNBfaJdf4n7OBfK8QyLRC0Kv6 ZjGQdJw/tzoK5Agy2h/XQK60MOIXmZyBQmFYhA9RT17ZFenlKMTFl0M/9RD2ZoOi M+bjJflx8ljH8N+MgJpAafy52LKGNbOXtes/Wt/Pjvayi8Bj5H+6IxfIKzXE= |
| X-Sasl-Enc | OEZ5pD0bOyWfkh34SHbw4z0GayCZ7+X536Xzg/+8AfFR 1454943163 |
| X-Mailer | MessagingEngine.com Webmail Interface - ajax-57359b3d |
| In-Reply-To | <CAG93HwH72zLDm-fnnzAuKUSqTqPF3YesX_m5pE8YHQUqbAe+xA@mail.gmail.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21rc2 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:102673 |
Show key headers only | View raw
On Mon, Feb 8, 2016, at 08:32, Matt Wheeler wrote:
> On 8 February 2016 at 12:17, Jussi Piitulainen
> <jussi.piitulainen@helsinki.fi> wrote:
> > Also, what would be the nicest current way to express a priority union
> > of dicts?
> >
> > { k:(d if k in d else e)[k] for k in d.keys() | e.keys() }
>
> Since Python 3.5: {**e, **d}
And before that... dict(ChainMap(d, e))
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Set Operations on Dicts Marco Kaulea <marco.kaulea@gmail.com> - 2016-02-08 10:56 +0100
Re: Set Operations on Dicts Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-02-08 14:17 +0200
Re: Set Operations on Dicts Marco Kaulea <marco.kaulea@gmail.com> - 2016-02-08 13:33 +0100
Re: Set Operations on Dicts Matt Wheeler <m@funkyhat.org> - 2016-02-08 13:32 +0000
Re: Set Operations on Dicts Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-02-08 16:02 +0200
Re: Set Operations on Dicts Random832 <random832@fastmail.com> - 2016-02-08 09:52 -0500
Re: Set Operations on Dicts Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-02-08 17:05 +0200
Re: Set Operations on Dicts Grobu <snailcoder@retrosite.invalid> - 2016-02-08 13:47 +0100
Re: Set Operations on Dicts Ian Kelly <ian.g.kelly@gmail.com> - 2016-02-08 09:12 -0700
Re: Set Operations on Dicts Grobu <snailcoder@retrosite.invalid> - 2016-02-09 08:21 +0100
Re: Set Operations on Dicts Ian Kelly <ian.g.kelly@gmail.com> - 2016-02-09 08:14 -0700
csiph-web