Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #3882
| 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 | 2011-04-22 11:19 -0400 |
| Subject | Re: suggestions, comments on an "is_subdict" test |
| From | Zero Piraeus <schesis@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.755.1303485595.9059.python-list@python.org> (permalink) |
: >> 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
Re: suggestions, comments on an "is_subdict" test Zero Piraeus <schesis@gmail.com> - 2011-04-22 11:19 -0400
csiph-web