Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #6382
| From | Duncan Booth <duncan.booth@invalid.invalid> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: bug in str.startswith() and str.endswith() |
| Date | 2011-05-27 10:31 +0000 |
| Message-ID | <Xns9EF2753877752duncanbooth@127.0.0.1> (permalink) |
| References | <mailman.2139.1306457951.9059.python-list@python.org> |
Carl Banks <pavlovevidence@gmail.com> wrote:
> The end parameter looks pretty useless for
> .startswith() and is probably only present for consistency with other
> string search methods like .index().
No, the end parameter could be useful if the slice ends up shorter than the
prefix string:
>>> 'abcd'.startswith('abc', 0, 2)
False
Likewise the start parameter for endswith.
--
Duncan Booth http://kupuguy.blogspot.com
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: bug in str.startswith() and str.endswith() Carl Banks <pavlovevidence@gmail.com> - 2011-05-26 17:59 -0700 Re: bug in str.startswith() and str.endswith() Duncan Booth <duncan.booth@invalid.invalid> - 2011-05-27 10:31 +0000
csiph-web