Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #17988
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'python,': 0.01; 'subject:bug': 0.04; 'indexes': 0.09; 'referencing': 0.09; 'subject:string': 0.09; 'am,': 0.12; 'received:209.85.210.174': 0.13; 'received:mail-iy0-f174.google.com': 0.13; '"from': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'helps!': 0.16; 'subject:handling': 0.16; 'wrote:': 0.18; 'dec': 0.22; '(or': 0.22; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'incorrect': 0.23; 'indexing': 0.23; 'code': 0.25; 'expect': 0.26; 'code,': 0.27; 'asking': 0.28; 'bit': 0.28; 'message- id:@mail.gmail.com': 0.28; '27,': 0.29; 'character.': 0.30; 'chris': 0.30; "i've": 0.31; 'tue,': 0.32; 'actually': 0.33; 'rather': 0.33; 'to:addr:python-list': 0.34; 'character': 0.34; 'see,': 0.34; 'subject:work': 0.34; 'subject:with': 0.36; 'themselves.': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'using': 0.38; 'received:209.85': 0.38; 'subject: (': 0.40; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'hope': 0.61; '2011': 0.61; 'your': 0.61; 'cause': 0.67; 'charles': 0.67; 'marker': 0.84; 'subject:Possible': 0.84; 'examining': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=tFKJAP6w//SueQ+dppVr53fpd22EClMeI0c0mHkks8M=; b=gp8764IBgjvXphC6dvgPcv86IcyDWdcUSsTpL0c2s40GSLtW8LOl4z0Rhg8sU5elrO 7ff/orzMQy4okB6Th68EkuCDWvh4i2dmMGAfOiB5cPP1m2e6vo9r7t1Takps2YFicDkX PUJvk2ZN9ijHCALxIPsrvZOgurJ8p/u/ihJvI= |
| MIME-Version | 1.0 |
| In-Reply-To | <4EF8F3C7.3010005@earthlink.net> |
| References | <4EF8F3C7.3010005@earthlink.net> |
| Date | Tue, 27 Dec 2011 09:44:59 +1100 |
| Subject | Re: Possible bug in string handling (with kludgy work-around) |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| 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.4114.1324939502.27778.python-list@python.org> (permalink) |
| Lines | 21 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1324939502 news.xs4all.nl 6986 [2001:888:2000:d::a6]:37145 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:17988 |
Show key headers only | View raw
On Tue, Dec 27, 2011 at 9:23 AM, Charles Hixson <charleshixsn@earthlink.net> wrote: > This doesn't cause a crash, but rather incorrect results. You may need to be a bit clearer. What line of code (or what expression)? What did you expect to see, and what did you see? >From examining your code, I've come up with one most-likely scenario. In Python, indexing is zero-based and, in effect, indexes the boundaries between items rather than the items themselves. Referencing string[-1] actually means asking for the boundary between the second-last and last characters; using that as your end marker actually trims off the last character. What you may want is simply: self.wordList[i][1:] which means "from character position 1 to the end of the string". Hope that helps! Chris Angelico
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Possible bug in string handling (with kludgy work-around) Chris Angelico <rosuav@gmail.com> - 2011-12-27 09:44 +1100
csiph-web