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


Groups > comp.lang.python > #3882

Re: suggestions, comments on an "is_subdict" test

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <z@etiol.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'subject:" ': 0.03; 'subject:test': 0.05; 'def': 0.13; 'really?': 0.16; 'this?': 0.18; 'header:In-Reply-To:1': 0.22; 'received:209.85.220': 0.26; 'message-id:@mail.gmail.com': 0.28; 'raise': 0.29; 'missed': 0.29; 'supposed': 0.31; 'to:addr:python-list': 0.32; '...': 0.32; 'received:209.85': 0.37; 'received:google.com': 0.38; 'anything': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'header:Received:5': 0.40
MIME-Version 1.0
Sender z@etiol.net
X-Originating-IP [200.107.244.177]
In-Reply-To <BANLkTi=mOP8GeSoC7hetdf2Zp26e0TAkig@mail.gmail.com>
References <BANLkTinazu41uVqxmkfTns0ZOHScZ1a3nQ@mail.gmail.com> <4DB190DC.8050307@mrabarnett.plus.com> <BANLkTikk8VvoTmBG7YPD1A54v_3=SHz-vQ@mail.gmail.com> <ios5g6$ji1$1@dough.gmane.org> <BANLkTi=mOP8GeSoC7hetdf2Zp26e0TAkig@mail.gmail.com>
Date Fri, 22 Apr 2011 11:19:52 -0400
X-Google-Sender-Auth DVvwpWAEfIV2X47W5o5c49ZIbgg
Subject Re: suggestions, comments on an "is_subdict" test
From Zero Piraeus <schesis@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
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.755.1303485595.9059.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 82.94.164.166
X-Trace 1303485595 news.xs4all.nl 41110 [::ffff:82.94.164.166]:58957
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:3882

Show key headers only | View raw


:

>> 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.

Really? That was what ``test_dct <= base_dct and`` ... is supposed to
prevent. Have I missed something?

 -[]z.

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


Thread

Re: suggestions, comments on an "is_subdict" test Zero Piraeus <schesis@gmail.com> - 2011-04-22 11:19 -0400

csiph-web