Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #3880
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:" ': 0.03; 'subject:test': 0.05; 'dictionary': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; '>>>': 0.12; 'def': 0.13; 'wrote:': 0.14; 'piraeus': 0.16; 'received:dip.t-dialin.net': 0.16; 'received:t-dialin.net': 0.16; 'this?': 0.18; 'code': 0.22; 'testing': 0.28; 'raise': 0.29; 'from:addr:web.de': 0.31; 'to:addr :python-list': 0.32; 'reference': 0.34; 'header:X-Complaints- To:1': 0.34; 'received:org': 0.38; 'anything': 0.38; 'comments': 0.39; 'to:addr:python.org': 0.39; 'header:Mime-Version:1': 0.39; 'i.e.': 0.40; 'header:Received:5': 0.40; 'simple': 0.60 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Peter Otten <__peter__@web.de> |
| Subject | Re: suggestions, comments on an "is_subdict" test |
| Date | Fri, 22 Apr 2011 17:06:03 +0200 |
| Organization | None |
| References | <BANLkTinazu41uVqxmkfTns0ZOHScZ1a3nQ@mail.gmail.com> <4DB190DC.8050307@mrabarnett.plus.com> <BANLkTikk8VvoTmBG7YPD1A54v_3=SHz-vQ@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Gmane-NNTP-Posting-Host | p5084c898.dip.t-dialin.net |
| 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.753.1303484755.9059.python-list@python.org> (permalink) |
| Lines | 16 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1303484755 news.xs4all.nl 41103 [::ffff:82.94.164.166]:48517 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:3880 |
Show key headers only | View raw
Zero Piraeus wrote: > : > >>> I'd like to ask for comments or advice on a simple code for testing a >>> "subdict", i.e. check whether all items of a given dictionary are >>> present in a reference dictionary. > > Anything wrong with this? > > def is_subdict(test_dct, base_dct): > return test_dct <= base_dct and all(test_dct[k] == base_dct[k] for > k in test_dct) It may raise a KeyError.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: suggestions, comments on an "is_subdict" test Peter Otten <__peter__@web.de> - 2011-04-22 17:06 +0200
csiph-web