[issue42776] The string find method shows the problem

2020-12-29 Thread Eric V. Smith


Eric V. Smith  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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42776] The string find method shows the problem

2020-12-28 Thread ye andy

ye andy  added the comment:

When I say True here, I'm not talking about querying, I'm talking about
syntax, as far as I know, document is supposed to support keyword
arguments, but it doesn't

Steven D'Aprano  于2020年12月29日周二 上午11:36写道:

>
> Steven D'Aprano  added the comment:
>
> # True
> data.find('a', 0)
>
> That will return 0, not True.
>
>
> # False
> data.find('a', start=0)
>
>
> And that will raise TypeError, not return False.
>
>
> What exactly are you reporting here? I have read your bug report, and
> looked at the screen shot, and I have no idea what problem you think you
> have found or what you want to change about the documentation.
>
> --
> nosy: +steven.daprano
>
> ___
> Python tracker 
> 
> ___
>

--
nosy: +andy.ye.jx

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42776] The string find method shows the problem

2020-12-28 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

# True
data.find('a', 0)

That will return 0, not True.


# False
data.find('a', start=0)


And that will raise TypeError, not return False.


What exactly are you reporting here? I have read your bug report, and looked at 
the screen shot, and I have no idea what problem you think you have found or 
what you want to change about the documentation.

--
nosy: +steven.daprano

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42776] The string find method shows the problem

2020-12-28 Thread andy ye

New submission from andy ye :

data = 'abcddd'
# True
data.find('a', 0)

# False
data.find('a', start=0)


# document
class str(obj):

def find(self, sub, start=None, end=None): # real signature unknown; 
restored from __doc__
"""
S.find(sub[, start[, end]]) -> int

Return the lowest index in S where substring sub is found,
such that sub is contained within S[start:end].  Optional
arguments start and end are interpreted as in slice notation.

Return -1 on failure.
"""
return 0

--
assignee: docs@python
components: Documentation
files: 截屏2020-12-29 上午10.57.53.png
messages: 383949
nosy: andyye, docs@python
priority: normal
severity: normal
status: open
title: The string find method shows the problem
versions: Python 3.6
Added file: https://bugs.python.org/file49704/截屏2020-12-29 上午10.57.53.png

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com