Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #3877 > unrolled thread
| Started by | Wolfgang Rohdewald <wolfgang@rohdewald.de> |
|---|---|
| First post | 2011-04-22 16:43 +0200 |
| Last post | 2011-04-22 16:43 +0200 |
| 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.
Re: suggestions, comments on an "is_subdict" test Wolfgang Rohdewald <wolfgang@rohdewald.de> - 2011-04-22 16:43 +0200
| From | Wolfgang Rohdewald <wolfgang@rohdewald.de> |
|---|---|
| Date | 2011-04-22 16:43 +0200 |
| Subject | Re: suggestions, comments on an "is_subdict" test |
| Message-ID | <mailman.752.1303483438.9059.python-list@python.org> |
On Freitag 22 April 2011, Vlastimil Brom wrote: > check whether all items of a given dictionary are > present in a reference dictionary I would not call this is_subdict. That name does not clearly express that all keys need to have the same value. set(subdict.items()) <= set(reference.items()) should be equivalent to your code if you only want to check for presence of all keys in the reference dict: set(subdict.keys()) <= set(reference.keys()) -- Wolfgang
Back to top | Article view | comp.lang.python
csiph-web