Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; '21,': 0.07; 'strict': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'spaces': 0.09; "wouldn't": 0.14; '>on': 0.16; '>the': 0.16; 'adam': 0.16; 'message-id:@4ax.com': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'spacing': 0.16; 'sat,': 0.16; 'ignore': 0.16; 'wrote:': 0.18; '(but': 0.19; 'print': 0.22; '(such': 0.24; 'subject:problem': 0.24; 'url:home': 0.24; 'subject:/': 0.26; 'header:X-Complaints-To:1': 0.27; 'chris': 0.29; "i'm": 0.30; 'included': 0.31; 'lines': 0.31; 'file': 0.32; 'fri,': 0.33; "i'd": 0.34; 'definition': 0.35; 'but': 0.35; 'consist': 0.36; 'subject:Simple': 0.36; 'charset:us-ascii': 0.36; 'received:76': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'subject:can': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'letters': 0.60; 'matter': 0.61; "you're": 0.61; 'name': 0.63; 'between': 0.67; '>from': 0.68; 'combining': 0.68; 'saw': 0.77; 'subject:get': 0.81; 'detecting': 0.84; 'madam': 0.84; 'otten': 0.84; 'words)': 0.84; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Simple I/O problem can't get solved Date: Sat, 22 Jun 2013 12:58:24 -0400 Organization: IISS Elusive Unicorn References: <4785de5f-a84d-4417-9709-68bf2f4076e8@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-76-249-22-77.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371920311 news.xs4all.nl 15948 [2001:888:2000:d::a6]:34281 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:48935 On Sat, 22 Jun 2013 19:07:59 +1000, Chris Angelico declaimed the following: >On Fri, Jun 21, 2013 at 7:15 PM, Peter Otten <__peter__@web.de> wrote: >> Combining these modifications: >> >> for line in f: >> word = line.strip() >> if is_palindrome.is_palindrome(word): >> print word > >Minor quibble: I wouldn't use the name 'word' here, unless you're >expecting the file to consist of one-word lines (such as DICTOT.DIC >from old PMMail). For detecting phrase/sentence palindromes, I'd keep >the name 'line'. > There's also the matter of whether one is looking for strict palindromes -- where spacing is included (but not letter case) Able was I ere I saw Elba or a looser definition where only the letters are involved in the determination (again ignore case and punctuation, but also ignore the spaces between words) Madam I'm Adam -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/