Aldwin Pollefeyt <[email protected]> added the comment:
* text.startswith(prefix, start, end) seems the same as
text[start:end].startswith(prefix)
* text[start:end] with end>len(text) seems no issue, so also not an issue for
startswith
* text[8:12] in ('day', 'month', 'year') is not the same at all, rather:
For x in ('day', 'month', 'year'):
if text[8:12].startswith(x): return True
Else: return False
Maybe indeed could add to the documentation that 'text.startswith(prefix,
start, end)' is the same as 'text[start:end].startswith(prefix)'? Although
seemed obvious for me.
----------
nosy: +aldwinaldwin
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37490>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com