Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: 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; 'bug.': 0.07; 'end,': 0.07; 'see:': 0.07; 'slice': 0.07; "'this": 0.09; 'arguments,': 0.09; 'from:addr:python': 0.09; 'integers': 0.09; 'none)': 0.09; 'prefix': 0.09; 'prefix,': 0.09; 'prefixes': 0.09; 'start[,': 0.09; 'subject:()': 0.09; 'tuple': 0.09; 'this:': 0.10; 'wrote:': 0.14; 'bug?': 0.16; 'end]])': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'furman': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.92': 0.16; 'received:84.92.122': 0.16; 'received:84.92.122.60': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'reply-to:addr:python-list': 0.16; 'subject:() ': 0.16; 'suffix': 0.16; 'suffixes': 0.16; 'traceback': 0.16; '(most': 0.16; 'keyword': 0.19; 'subject:skip:s 10': 0.19; 'starts': 0.20; 'header:In-Reply-To:1': 0.21; "aren't": 0.22; 'indices': 0.23; 'last):': 0.23; 'optional': 0.23; 'received:84': 0.25; 'specified': 0.26; 'string': 0.26; 'tried': 0.27; 'position.': 0.29; 'start,': 0.29; 'false.': 0.30; 'none,': 0.30; 'typeerror:': 0.30; "can't": 0.32; 'to:addr:python-list': 0.33; "i've": 0.33; 'file': 0.34; 'header:User-Agent:1': 0.35; '"",': 0.35; 'reply-to:addr:python.org': 0.35; 'test': 0.35; 'none': 0.37; 'beginning': 0.37; 'comparing': 0.37; 'but': 0.38; 'docs': 0.38; 'subject:: ': 0.38; 'skip:s 20': 0.39; "i'd": 0.39; 'to:addr:python.org': 0.39; 'stop': 0.62; 'header:Reply-To:1': 0.72; 'reply-to:no real name:2**0': 0.72 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiUHACrh3k1UXebj/2dsb2JhbABUmCuOCnjFaIYcBJRyilg Date: Fri, 27 May 2011 00:27:22 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: python-list@python.org Subject: Re: bug in str.startswith() and str.endswith() References: <4DDEE1C8.6010107@stoneleaf.us> In-Reply-To: <4DDEE1C8.6010107@stoneleaf.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: python-list@python.org List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 31 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1306452453 news.xs4all.nl 49041 [::ffff:82.94.164.166]:44579 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6349 On 27/05/2011 00:27, Ethan Furman wrote: > 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 "", line 1, in > 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? > Let's see: 'start' and 'end' are optional, but aren't keyword arguments, and can't be None... I'd say bug.