Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #3876
| References | <BANLkTinazu41uVqxmkfTns0ZOHScZ1a3nQ@mail.gmail.com> <4DB190DC.8050307@mrabarnett.plus.com> |
|---|---|
| Date | 2011-04-22 10:43 -0400 |
| Subject | Re: suggestions, comments on an "is_subdict" test |
| From | Zero Piraeus <schesis@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.751.1303483390.9059.python-list@python.org> (permalink) |
:
>> 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)
-[]z.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: suggestions, comments on an "is_subdict" test Zero Piraeus <schesis@gmail.com> - 2011-04-22 10:43 -0400
csiph-web