Added a recommendation to use s2 in s1 for Python 2.3 and later.
This commit is contained in:
parent
0e10364dc7
commit
c055edb47d
11
pep-0290.txt
11
pep-0290.txt
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue