diff options
author | Georg Brandl <georg@python.org> | 2008-03-28 12:24:51 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-03-28 12:24:51 (GMT) |
commit | 489343e948516c5a010eb55b154a99c5b3a7004c (patch) | |
tree | 067f1eb1b34dd4b2e9d54daf0dc1b3c4f97a51a1 /Doc | |
parent | 8ca6c84b6f8a6cd0c76db8937d471bddb4bf2a1d (diff) | |
download | cpython-489343e948516c5a010eb55b154a99c5b3a7004c.zip cpython-489343e948516c5a010eb55b154a99c5b3a7004c.tar.gz cpython-489343e948516c5a010eb55b154a99c5b3a7004c.tar.bz2 |
Don't use the confusing term "set membership".
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/reference/expressions.rst | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index 0653910..8652453 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -1061,14 +1061,14 @@ Comparison of objects of the same type depends on the type: another one is made arbitrarily but consistently within one execution of a program. -The operators :keyword:`in` and :keyword:`not in` test for set membership. ``x -in s`` evaluates to true if *x* is a member of the set *s*, and false otherwise. -``x not in s`` returns the negation of ``x in s``. The set membership test has -traditionally been bound to sequences; an object is a member of a set if the set -is a sequence and contains an element equal to that object. However, it is -possible for an object to support membership tests without being a sequence. In -particular, dictionaries support membership testing as a nicer way of spelling -``key in dict``; other mapping types may follow suit. +The operators :keyword:`in` and :keyword:`not in` test for collection +membership. ``x in s`` evaluates to true if *x* is a member of the collection +*s*, and false otherwise. ``x not in s`` returns the negation of ``x in s``. +The collection membership test has traditionally been bound to sequences; an +object is a member of a collection if the collection is a sequence and contains +an element equal to that object. However, it make sense for many other object +types to support membership tests without being a sequence. In particular, +dictionaries (for keys) and sets support membership testing. For the list and tuple types, ``x in y`` is true if and only if there exists an index *i* such that ``x == y[i]`` is true. |