Added a recommendation to use s2 in s1 for Python 2.3 and later.

This commit is contained in:
Barry Warsaw 2002-08-12 14:22:33 +00:00
parent 0e10364dc7
commit c055edb47d
1 changed files with 11 additions and 0 deletions

View File

@ -153,6 +153,17 @@ Modernization Procedures
miscounting.
Pattern: "s1".find("s2") >= 0 or "s1".find("s2") != -1 -> "s2" in "s1"
Idea: In Python 2.3, for "s2" in "s1", the length
restriction on s2 are lifted; they can now be strings
of any length.
Version: 2.3 or later
Benefits: When searching for a substring, where you don't care
about the position of the substring in the original
string, using the `in' operator makes things more
clear.
References
[1] PEP 4, Deprecation of Standard Modules