Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102669
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Matt Wheeler <m@funkyhat.org> |
| Newsgroups | comp.lang.python |
| Subject | Re: Set Operations on Dicts |
| Date | Mon, 8 Feb 2016 13:32:36 +0000 |
| Lines | 13 |
| Message-ID | <mailman.96.1454938384.2317.python-list@python.org> (permalink) |
| References | <mailman.86.1454925476.2317.python-list@python.org> <lf5fux3xuov.fsf@ling.helsinki.fi> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de 15A7Ya5yZYS7DqfTON2PoQg7QblckeOyXwYbEOm0lm6Q== |
| Return-Path | <m@funkyhat.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.090 |
| X-Spam-Evidence | '*H*': 0.84; '*S*': 0.02; 'python': 0.10; '12:17,': 0.16; '2016': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'header:In-Reply-To:1': 0.24; 'message- id:@mail.gmail.com': 0.27; 'received:google.com': 0.35; 'received:74.125.82': 0.35; 'express': 0.35; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'to:addr:python.org': 0.40; 'union': 0.67; 'from:addr:m': 0.84; 'subject:Set': 0.91 |
| X-Virus-Scanned | Debian amavisd-new at membrane.funkyhat.net |
| X-Gm-Message-State | AG10YORJVDPsOF5h7K/f/bCcFtmM0M5tfOfQZrbPrw3ieFljo9Uyd3mSLSyJChHzhdOHXe9Eg1RbFG8wd6Ekhw== |
| X-Received | by 10.194.71.46 with SMTP id r14mr10655337wju.99.1454938375396; Mon, 08 Feb 2016 05:32:55 -0800 (PST) |
| In-Reply-To | <lf5fux3xuov.fsf@ling.helsinki.fi> |
| X-Gmail-Original-Message-ID | <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:102669 |
Show key headers only | View raw
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}
--
Matt Wheeler
http://funkyh.at
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