[docs] Possible Python string.find() documentation error

Georg Brandl georg at python.org
Sat Jul 23 08:01:17 CEST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 23.07.2011 00:33, schrieb Brett D Rasmussen:
> 
> Hello.
> 
> The web page at:  http://docs.python.org/library/string.html
> 
> contains the following entry
> 
> string.find(/s/, /sub/[, /start/[, /end/]])¶ 
> <http://docs.python.org/library/string.html#string.find> Return the lowest
> index in /s/ where the substring /sub/ is found such that /sub/ is wholly
> contained in s[start:end]. Return -1 on failure. Defaults for /start/ and
> /end/ and interpretation of negative values is the same as for slices.
> 
> I believe that the first find() parameter should be removed (i.e. "s").
> 
> The web page at: http://docs.python.org/library/stdtypes.html contains the
> text
> 
> str.find(/sub/[, /start/[, /end/]])¶ 
> <http://docs.python.org/library/stdtypes.html#str.find>
> 
> Return the lowest index in the string where substring /sub/ is found, such 
> that /sub/ is contained in the slice s[start:end]. Optional arguments /start/
> and /end/ are interpreted as in slice notation. Return -1 if /sub/ is not
> found.
> 
> where the .find method does not include the "s" parameter.
> 
> 
> (Code testing shows that a string.find() call expects one 'search-target'
> string (i.e. sub)  )

Hi Brett,

the "string.find" entry describes the (deprecated) function find() in the string
module, not the method of the string type, so the description is correct there.

cheers,
Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)

iEYEARECAAYFAk4qY6wACgkQN9GcIYhpnLAXDgCfW+Swok/Xj91V7bq9k3JaAZ1L
wuwAni8Spi/EUc1EmvCFQw75J90SmbVD
=atYt
-----END PGP SIGNATURE-----


More information about the docs mailing list