Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #3894
| Date | 2011-04-22 21:57 +0100 |
|---|---|
| From | MRAB <python@mrabarnett.plus.com> |
| Subject | Re: suggestions, comments on an "is_subdict" test |
| References | <BANLkTinazu41uVqxmkfTns0ZOHScZ1a3nQ@mail.gmail.com> <4DB190DC.8050307@mrabarnett.plus.com> <BANLkTin6SZP4gvWmv499DGFBsLxYYC3rCQ@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.766.1303505884.9059.python-list@python.org> (permalink) |
On 22/04/2011 21:31, Vlastimil Brom wrote: > Thanks everyone for your opinions and suggestions! > I especially like the all(...) approaches of MRAB and Peter Otten, > however, the set conversion like >>>> set(test_dct.items())<= set(base_dct.items()) > True > looks elegant too. That works only if the values in the dicts are hashable. > In both approaches I can get rid of the negated comparison and the > additional "parsing cost" (for me reading it) is not that high. > > As for the name, I tried to make explicit (for this post), that both > the keys and their values are important in this test, but it doesn't > matter that much if is_subdict doesn't communicate this well > (probably?), as the "audience" of this code is not going to be anyone > but me. >
Back to comp.lang.python | Previous | Next | Find similar
Re: suggestions, comments on an "is_subdict" test MRAB <python@mrabarnett.plus.com> - 2011-04-22 21:57 +0100
csiph-web