[issue42776] The string find method shows the problem

Eric V. Smith report at bugs.python.org
Tue Dec 29 06:45:33 EST 2020


Eric V. Smith <eric at trueblade.com> added the comment:

'abcddd'.find('a', start=0) would appear to be allowed from the help text, but it isn't legal. This is because .find() does not allow keyword arguments.

It looks like find could be documented as
find(self, sub, start=None, end=None, /)

Although it doesn't look like any of the str methods use self in the documentation.

I'm reasonably sure None is correct as the default for start and end, but I suspect it's not universally true of str methods that None works as the default. So it wouldn't surprise me if not all of the str methods  can be expressed in python code.

----------
nosy: +eric.smith

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42776>
_______________________________________


More information about the Python-bugs-list mailing list