summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2011-05-09 00:54:30 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2011-05-09 00:54:30 (GMT)
commit0ed8c6897c2330950643fda6c6e8ee283c030311 (patch)
tree9d37a6f65f8b9f0efd8d0ff4335edc943d339367 /Doc
parent262c5827a5cc0c1902bd4fadad95a3ad8d267e98 (diff)
downloadcpython-0ed8c6897c2330950643fda6c6e8ee283c030311.zip
cpython-0ed8c6897c2330950643fda6c6e8ee283c030311.tar.gz
cpython-0ed8c6897c2330950643fda6c6e8ee283c030311.tar.bz2
Add a note to the str.find doc to suggest the use of the "in" operator.
Diffstat (limited to 'Doc')
-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 7621eef..2e3e18f 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -883,6 +883,15 @@ 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)