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


Groups > comp.lang.python > #3882 > unrolled thread

Re: suggestions, comments on an "is_subdict" test

Started byZero Piraeus <schesis@gmail.com>
First post2011-04-22 11:19 -0400
Last post2011-04-22 11:19 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#3882 — Re: suggestions, comments on an "is_subdict" test

FromZero Piraeus <schesis@gmail.com>
Date2011-04-22 11:19 -0400
SubjectRe: suggestions, comments on an "is_subdict" test
Message-ID<mailman.755.1303485595.9059.python-list@python.org>
:

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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web