This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author v+python
Recipients aldwinaldwin, holdenweb, steven.daprano, v+python
Date 2019-07-03.10:31:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1562149886.63.0.330290506713.issue37490@roundup.psfhosted.org>
In-reply-to
Content
Thanks for the explanations and suggestions. Now that I think I know what those parameters are used for...

Sorry, my first example was tweaked on the fly, and doesn't make as much sense as it could because it wound up being a mix of pre-tweaked and tweaked text, as Steven points out at the beginning of msg347194.

But the text he suggests in msg347195 would be an immense clarification to the existing text. The existing text is worded in such a way that it is not clear how the start and end parameters affect the search, except by analogy with other slicing operations in other parts of Python. Steven may be willing to draw such analogies to perceive that the current startswith documentation is clear, but if you go in with an open mind, uncluttered with the better-specified behavior of other Python operations, there are lots of possible interpretations. Describing the start/end parameters with defaults and explaining the whole operation as referring to the slice specified by those parameters makes it far less open to other interpretations.

The text Aldwin suggests in msg347188 (from re) is better than the original for startswith/endswith, but is not as clear as Steven's wording. I would actually suggest that Steven's wording could be the basis for an improvement for the re docs as quoted.

The second part, the "prefix can also be a tuple of prefixes to look for" could also be improved... neither prefix nor tuple of prefixes is defined as being a string.

Further, if the parameter syntax is shown with the defaults, then the parethetical comments about (defaults to...) are not really necessary, simplifying the description to:

The prefix parameter can be a single string, or a tuple of strings.
Return True if the slice of string specified by [start:end] starts with any complete string supplied as part of the prefix parameter, otherwise return False.
History
Date User Action Args
2019-07-03 10:31:26v+pythonsetrecipients: + v+python, holdenweb, steven.daprano, aldwinaldwin
2019-07-03 10:31:26v+pythonsetmessageid: <1562149886.63.0.330290506713.issue37490@roundup.psfhosted.org>
2019-07-03 10:31:26v+pythonlinkissue37490 messages
2019-07-03 10:31:25v+pythoncreate