diff options
author | Guido van Rossum <guido@python.org> | 2001-04-20 16:50:40 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-04-20 16:50:40 (GMT) |
commit | 0dbb4fba4c59741466ac18eeb946ca56989717d4 (patch) | |
tree | c7c0fe7c20813024cb023075b597fee3c99abd64 /Doc/ref/ref5.tex | |
parent | 78fe5308b427298a2bb3c80c1d0f6117d18fcf62 (diff) | |
download | cpython-0dbb4fba4c59741466ac18eeb946ca56989717d4.zip cpython-0dbb4fba4c59741466ac18eeb946ca56989717d4.tar.gz cpython-0dbb4fba4c59741466ac18eeb946ca56989717d4.tar.bz2 |
Implement, test and document "key in dict" and "key not in dict".
I know some people don't like this -- if it's really controversial,
I'll take it out again. (If it's only Alex Martelli who doesn't like
it, that doesn't count as "real controversial" though. :-)
That's why this is a separate checkin from the iterators stuff I'm
about to check in next.
Diffstat (limited to 'Doc/ref/ref5.tex')
-rw-r--r-- | Doc/ref/ref5.tex | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Doc/ref/ref5.tex b/Doc/ref/ref5.tex index 5663daa..ec0c6b1 100644 --- a/Doc/ref/ref5.tex +++ b/Doc/ref/ref5.tex @@ -768,7 +768,9 @@ not in \var{s}} returns the negation of \code{\var{x} in \var{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. +to support membership tests without being a sequence. In particular, +dictionaries support memership testing as a nicer way of spelling +\code{\var{key} in \var{dict}}; other mapping types may follow suit. For the list and tuple types, \code{\var{x} in \var{y}} is true if and only if there exists an index \var{i} such that |