Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #6382
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.mixmin.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Duncan Booth <duncan.booth@invalid.invalid> |
| Newsgroups | comp.lang.python |
| Subject | Re: bug in str.startswith() and str.endswith() |
| Date | 27 May 2011 10:31:44 GMT |
| Lines | 16 |
| Message-ID | <Xns9EF2753877752duncanbooth@127.0.0.1> (permalink) |
| References | <mailman.2139.1306457951.9059.python-list@python.org> |
| Reply-To | duncan.booth@suttoncourtenay.org.uk |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-1 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | individual.net SS2+X8PqC1aT3WVajiALxwQimXKkIkFW8AEH45VEtHs2xTugX8 |
| Cancel-Lock | sha1:2pqBVI4U9a3pgsKAVKzXfpeD7Ns= |
| User-Agent | Xnews/2006.08.24 Hamster/2.1.0.11 |
| X-Face | .C;/v3#w@2k.C(.1v-}d=`|7AQ-%,#A$0ZGtAkLPvuawAM>3#D,pXaAb31%(=Gn2ZZK/Z~fd0y4't5iKK~F":}F2*|\mQYX+BUr4ZM*|+`@o-TKzFGwsJnan{)*b~QJ-Fu^u'$$nYV |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:6382 |
Show key headers only | View raw
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