summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2011-05-09 03:54:30 +0300
committerEzio Melotti <ezio.melotti@gmail.com>2011-05-09 03:54:30 +0300
commit87b86c84ef2755d628969b024b103a538d8f57f2 (patch)
tree50e6f661f2208ec290a6de82b47b53788a2714c9
parent01c9a160310b9456391a008e1bd8da701f0f0241 (diff)
downloadcpython-git-87b86c84ef2755d628969b024b103a538d8f57f2.tar.gz
Add a note to the str.find doc to suggest the use of the "in" operator.
-rw-r--r--Doc/library/stdtypes.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 64496326f7..0e32348b9b 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -944,6 +944,15 @@ string functions based on regular expressions.
*start* and *end* are interpreted as in slice notation. Return ``-1`` if
*sub* is not found.
+ .. note::
+
+ The :meth:`~str.find` method should be used only if you need to know the
+ position of *sub*. To check if *sub* is a substring or not, use the
+ :keyword:`in` operator::
+
+ >>> 'Py' in 'Python'
+ True
+
.. method:: str.format(*args, **kwargs)