Skip to content

Commit f9a0857

Browse files
committed
Update __contains__ documentation for views
[skip ci]
1 parent 3f0f0e6 commit f9a0857

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

docs/documentation.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,15 @@ The behaviour is equivalent to that of [`len(d)`](#lend) where `d` is the underl
770770

771771
Return whether `ob` is present in the sorted dictionary view `v`.
772772

773-
If `v` is of type `SortedDictKeys`, the behaviour is equivalent to that of [`ob in d`](#key-in-d) where `d` is the
774-
underlying sorted dictionary.
773+
If `v` is of type `SortedDictItems` and `ob` is not a two-element `tuple`, this expression evaluates to `False`. If
774+
`ob` is a two-element `tuple`, the behaviour is equivalent to that of `ob[0] in d and d[ob[0]] == ob[1]`, where `d` is
775+
the underlying sorted dictionary.
776+
777+
If `v` is of type `SortedDictKeys`, the behaviour is equivalent to that of [`ob in d`](#key-in-d), where, once again,
778+
`d` is the underlying sorted dictionary.
779+
780+
Finally, if `v` is of type `SortedDictValues`, the behaviour is equivalent to that of `ob in l`, where `l` is a `list`
781+
of the elements in `v` in the same order. (In other words, an element-by-element comparison is performed.)
775782

776783
#### `v[pos]` or `v[start:stop:step]`
777784

0 commit comments

Comments
 (0)