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


Groups > comp.lang.python > #17986

Possible bug in string handling (with kludgy work-around)

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!news-transit.tcx.org.uk!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <charleshixsn@earthlink.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.019
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'elif': 0.04; 'subject:bug': 0.04; 'message-id:@earthlink.net': 0.09; 'subject:string': 0.09; '(len': 0.16; 'received:66.245': 0.16; 'received:dsl.mindspring.com': 0.16; 'str):': 0.16; 'subject:handling': 0.16; 'tmp': 0.16; "doesn't": 0.22; 'incorrect': 0.23; 'sep': 0.23; 'from:addr:earthlink.net': 0.29; 'print': 0.29; 'error': 0.29; 'header:User-Agent:1': 0.33; 'rather': 0.33; 'to:addr:python-list': 0.34; 'subject:work': 0.34; 'subject:with': 0.36; 'skip:" 10': 0.37; 'but': 0.37; 'subject: (': 0.40; 'to:addr:python.org': 0.40; 'range': 0.61; 'cause': 0.67; 'charles': 0.67; 'received:207.69': 0.84; 'received:207.69.195': 0.84; 'subject:Possible': 0.84
Date Mon, 26 Dec 2011 14:23:03 -0800
From Charles Hixson <charleshixsn@earthlink.net>
User-Agent Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.1.16) Gecko/20111110 Iceowl/1.0b1 Icedove/3.0.11
MIME-Version 1.0
To python-list@python.org
Subject Possible bug in string handling (with kludgy work-around)
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
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.4112.1324938867.27778.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1324938867 news.xs4all.nl 6969 [2001:888:2000:d::a6]:59429
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:17986

Show key headers only | View raw


This doesn't cause a crash, but rather incorrect results.

self.wordList    =    ["The", "quick", "brown", "fox", "carefully",
                 "jumps", "over", "the", "lazy", "dog", "as", "it",
                 "stealthily", "wends", "its", "way", "homewards", '\b.']
for    i    in    range (len (self.wordList) ):
    if    not isinstance(self.wordList[i], str):
        self.wordList = ""
   elif self.wordList[i] != "" and self.wordList[i][0] == "\b":
        print ("0: wordList[", i, "] = \"", self.wordList[i], "\"", sep 
= "")
        print ("0a: wordList[", i, "][1] = \"", self.wordList[i][1], 
"\"", sep = "")
        tmp    =    self.wordList[i][1]             ## !! Kludge -- 
remove tmp to see the error
        self.wordList[i]    =    tmp + self.wordList[i][1:-1]  ## !! 
Kludge -- remove tmp + to see the error
        print ("1: wordList[", i, "] = \"", self.wordList[i], "\"", sep 
= "")
        print    ("len(wordList[", i, "]) = ", len(self.wordList[i]) )

-- 
Charles Hixson

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


Thread

Possible bug in string handling (with kludgy work-around) Charles Hixson <charleshixsn@earthlink.net> - 2011-12-26 14:23 -0800
  Re: Possible bug in string handling (with kludgy work-around) Rick Johnson <rantingrickjohnson@gmail.com> - 2011-12-26 14:48 -0800
    Re: Possible bug in string handling (with kludgy work-around) Chris Angelico <rosuav@gmail.com> - 2011-12-27 10:05 +1100
  Re: Possible bug in string handling (with kludgy work-around) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-27 01:10 +0000
    Re: Possible bug in string handling (with kludgy work-around) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-12-27 09:53 -0500
      Re: Possible bug in string handling (with kludgy work-around) Rick Johnson <rantingrickjohnson@gmail.com> - 2011-12-27 10:04 -0800
        Re: Possible bug in string handling (with kludgy work-around) Lie Ryan <lie.1296@gmail.com> - 2011-12-28 08:23 +1100
        Re: Possible bug in string handling (with kludgy work-around) Terry Reedy <tjreedy@udel.edu> - 2011-12-27 16:38 -0500
          Re: Possible bug in string handling (with kludgy work-around) Rick Johnson <rantingrickjohnson@gmail.com> - 2011-12-27 16:57 -0800
            Re: Possible bug in string handling (with kludgy work-around) Lie Ryan <lie.1296@gmail.com> - 2011-12-29 04:54 +1100
        Re: Possible bug in string handling (with kludgy work-around) Terry Reedy <tjreedy@udel.edu> - 2011-12-27 16:38 -0500

csiph-web