Glenn Linderman <v+pyt...@g.nevcal.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37490>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to