Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #6348

bug in str.startswith() and str.endswith()

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ethan@stoneleaf.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:bug': 0.04; '3.2': 0.05; 'end,': 0.07; 'slice': 0.07; "'this": 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'integers': 0.09; 'message- id:@stoneleaf.us': 0.09; 'none)': 0.09; 'prefix': 0.09; 'prefix,': 0.09; 'prefixes': 0.09; 'received:gator410.hostgator.com': 0.09; 'start[,': 0.09; 'subject:()': 0.09; 'tuple': 0.09; '~ethan~': 0.09; 'this:': 0.10; 'bug?': 0.16; 'end]])': 0.16; 'received:72.11': 0.16; 'received:72.11.125': 0.16; 'received:72.11.125.166': 0.16; 'subject:() ': 0.16; 'suffix': 0.16; 'suffixes': 0.16; 'traceback': 0.16; '(most': 0.16; 'subject:skip:s 10': 0.19; 'starts': 0.20; 'indices': 0.23; 'last):': 0.23; 'optional': 0.23; 'specified': 0.26; 'string': 0.26; 'tried': 0.27; 'position.': 0.29; 'start,': 0.29; 'false.': 0.30; 'none,': 0.30; 'typeerror:': 0.30; 'to:addr:python-list': 0.33; "i've": 0.33; 'file': 0.34; 'header:User-Agent:1': 0.35; '"",': 0.35; 'test': 0.35; 'none': 0.37; 'beginning': 0.37; 'comparing': 0.37; 'docs': 0.38; 'skip:s 20': 0.39; 'to:addr:python.org': 0.39; 'stop': 0.62; 'received:websitewelcome.com': 0.67; 'received:69.56': 0.77; 'received:69.56.160': 0.84; 'received:gateway16.websitewelcome.com': 0.84
Date Thu, 26 May 2011 16:27:04 -0700
From Ethan Furman <ethan@stoneleaf.us>
User-Agent Thunderbird 1.5.0.10 (Windows/20070221)
MIME-Version 1.0
To Python <python-list@python.org>
Subject bug in str.startswith() and str.endswith()
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - gator410.hostgator.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - stoneleaf.us
X-Source
X-Source-Args
X-Source-Dir
X-Source-Sender mail.admailinc.com ([192.168.10.136]) [72.11.125.166]:4332
X-Source-Auth ethan+stoneleaf.us
X-Email-Count 1
X-Source-Cap dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ==
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2136.1306451668.9059.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 82.94.164.166
X-Trace 1306451668 news.xs4all.nl 49183 [::ffff:82.94.164.166]:59613
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:6348

Show key headers only | View raw


I've tried this in 2.5 - 3.2:

--> 'this is a test'.startswith('this')
True
--> 'this is a test'.startswith('this', None, None)
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
TypeError: slice indices must be integers or None or have an __index__ 
method

The 3.2 docs say this:

str.startswith(prefix[, start[, end]])
Return True if string starts with the prefix, otherwise return False. 
prefix can also be a tuple of prefixes to look for. With optional start, 
test string beginning at that position. With optional end, stop 
comparing string at that position

str.endswith(suffix[, start[, end]])
Return True if the string ends with the specified suffix, otherwise 
return False. suffix can also be a tuple of suffixes to look for. With 
optional start, test beginning at that position. With optional end, stop 
comparing at that position.

Any reason this is not a bug?

~Ethan~

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

bug in str.startswith() and str.endswith() Ethan Furman <ethan@stoneleaf.us> - 2011-05-26 16:27 -0700
  Re: bug in str.startswith() and str.endswith() Mel <mwilson@the-wire.com> - 2011-05-26 21:07 -0400
  Re: bug in str.startswith() and str.endswith() Roy Smith <roy@panix.com> - 2011-05-26 21:13 -0400
    Re: bug in str.startswith() and str.endswith() Stefan Behnel <stefan_ml@behnel.de> - 2011-05-27 06:47 +0200
      Re: bug in str.startswith() and str.endswith() Roy Smith <roy@panix.com> - 2011-05-27 09:48 -0400

csiph-web