This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Fix set-like dictview doc
Type: Stage: needs patch
Components: Documentation Versions: Python 3.0
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: benjamin.peterson, georg.brandl, terry.reedy
Priority: normal Keywords:

Created on 2008-11-17 20:14 by terry.reedy, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg75979 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2008-11-17 20:14
I see two problems with the current (.rc2) doc on "Dictionary view
objects" that are set-like.

1. The first paragraph of the section ends with the fragment

"The keys and items views have a set-like character since their entries"

This is not only incomplete, but wrong.  Items views are set-like
(entries are unique and hashable) only if all values are hashable, as
revealed way at the end in a 'warning' that is only needed because of
the previous over-generalization.  I recommend that this fragment, the
one sentence after the 'x in dictview' entry, and the warning be
combined into one paragraph that tells the complete story at the
appropriate place, which is where the 'one sentence' is now.

"Keys views are set-like since their entries are unique and hashable. 
If all values are hashable, so that (key,value) pairs are unique and
hashable, then an items view is also set-like.  (Values views are not
treated as set-like since the entries are generally not unique.) Let
'set-view' and 'other' each be a set or set-like view.  Then the
following set operations are available."

This suggestion also addresses the second problem I see.  The set
operations are symmetric, but 'dictview op other' is not.  It excludes
the valid combination 'set op dictview'.  So I think all 4 ops should be
listed as 'set-view op other' instead, after the revised introduction above.
msg75983 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-11-17 21:48
Thanks! Fixed in r67244.
Date User Action Args
2022-04-11 14:56:41adminsetgithub: 48589
2008-11-17 21:48:01benjamin.petersonsetstatus: open -> closed
nosy: + benjamin.peterson
resolution: fixed
messages: + msg75983
2008-11-17 20:14:18terry.reedycreate