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: 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: References: <4DB190DC.8050307@mrabarnett.plus.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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 : >> Anything wrong with this? >> >> def is_subdict(test_dct, base_dct): >> =C2=A0 =C2=A0 return test_dct <=3D base_dct and all(test_dct[k] =3D=3D b= ase_dct[k] for >> k in test_dct) > > It may raise a KeyError. Really? That was what ``test_dct <=3D base_dct and`` ... is supposed to prevent. Have I missed something? =C2=A0-[]z.