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


Groups > comp.lang.python > #69850

Re: Keeping track of things with dictionaries

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'important,': 0.07; 'suddenly': 0.07; 'iterate': 0.09; 'newline': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subtle': 0.09; 'bug': 0.12; 'wrote': 0.14; 'language.': 0.14; 'lengths': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'skip:n 70': 0.16; 'subject:dictionaries': 0.16; 'wrote:': 0.18; 'obviously': 0.18; 'file,': 0.19; 'example': 0.22; 'saying': 0.22; 'header:X-Complaints-To:1': 0.27; 'see,': 0.30; 'included': 0.31; 'end,': 0.31; 'strip': 0.31; 'subject:with': 0.35; 'but': 0.35; 'words,': 0.36; "didn't": 0.36; 'thanks': 0.36; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'though,': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'hope': 0.61; 'length': 0.61; "you'll": 0.62; 'frank': 0.68; "'with'": 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From "Frank Millman" <frank@chagford.com>
Subject Re: Keeping track of things with dictionaries
Date Tue, 8 Apr 2014 11:41:20 +0200
References <534105ce$0$1365$4fafbaef@reader1.news.tin.it> <21ef5159-ad95-4d43-a2d6-7ecda941d978@googlegroups.com> <CAPTjJmqFBt2XX+BDfNHz0gaGOrDkhtpBzrR29DUWN36girzcSw@mail.gmail.com> <li07kt$4cl$1@ger.gmane.org> <CAPTjJmpK-rqX0fp6_4vXYUS2Z34Vc5fQ_qNTj+Q9+Kn8Y5UPAA@mail.gmail.com> <li0bri$2t9$1@ger.gmane.org> <CAPTjJmoRxEhX02ZviHiLO+qi+dD+81smbGGYcPECpHb5E=p4=A@mail.gmail.com> <li0ffi$rld$1@ger.gmane.org> <CAPTjJmpPAqmb6No7UDdDAdqG_jv9yz0sN4d70KAsksbwWR3jdg@mail.gmail.com>
X-Gmane-NNTP-Posting-Host 197.87.50.147
X-MSMail-Priority Normal
X-Newsreader Microsoft Outlook Express 6.00.3790.4657
X-RFC2646 Format=Flowed; Original
X-MimeOLE Produced By Microsoft MimeOLE V6.00.3790.4913
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.9007.1396950095.18130.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1396950095 news.xs4all.nl 2931 [2001:888:2000:d::a6]:60337
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:69850

Show key headers only | View raw


"Chris Angelico" <rosuav@gmail.com> wrote in message 
news:CAPTjJmpPAqmb6No7UDdDAdqG_jv9yz0sN4d70KAsksbwWR3jdg@mail.gmail.com...
> On Tue, Apr 8, 2014 at 7:28 PM, Frank Millman <frank@chagford.com> wrote:
>> Are you saying that
>>
>>     all([len(word) == 23 for word in words_by_length[23]])  # hope I got
>> that right
>>
>> will not return True?
>
> That'll return true. What it won't show, though, is the length of the
> word as you would understand it in the English language. You see, when
> you iterate over a file, you get strings that include a newline at the
> end, and that'll be included in the length :) So with a dictionary of
> English words, you'll see that "cat\n" is a four-letter word, and
> "python\n" is a seven-letter word. It's a subtle point, but an
> important one when you start looking at lengths of things that are
> suddenly off by one.
>
> Obviously the solution is to strip them, but I didn't want to pollute
> the example with that (nor a 'with' block). I didn't think it
> particularly important, and just acknowledged the bug in what I
> thought was a throw-away line :)
>

Got it - thanks

Frank


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


Thread

Keeping track of things with dictionaries Giuliano Bertoletti <gbe32241@libero.it> - 2014-04-06 09:44 +0200
  Re: Keeping track of things with dictionaries Peter Otten <__peter__@web.de> - 2014-04-06 10:23 +0200
  Re: Keeping track of things with dictionaries Josh English <Joshua.R.English@gmail.com> - 2014-04-07 21:02 -0700
    Re: Keeping track of things with dictionaries Chris Angelico <rosuav@gmail.com> - 2014-04-08 14:08 +1000
      Re: Keeping track of things with dictionaries Josh English <Joshua.R.English@gmail.com> - 2014-04-07 23:22 -0700
    Re: Keeping track of things with dictionaries "Frank Millman" <frank@chagford.com> - 2014-04-08 09:14 +0200
      Re: Keeping track of things with dictionaries Steven D'Aprano <steve@pearwood.info> - 2014-04-08 07:47 +0000
    Re: Keeping track of things with dictionaries Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-08 01:53 -0600
    Re: Keeping track of things with dictionaries Chris Angelico <rosuav@gmail.com> - 2014-04-08 18:00 +1000
    Re: Keeping track of things with dictionaries Peter Otten <__peter__@web.de> - 2014-04-08 10:21 +0200
    Re: Keeping track of things with dictionaries "Frank Millman" <frank@chagford.com> - 2014-04-08 10:26 +0200
    Re: Keeping track of things with dictionaries "Frank Millman" <frank@chagford.com> - 2014-04-08 10:31 +0200
      Re: Keeping track of things with dictionaries alex23 <wuwei23@gmail.com> - 2014-04-09 12:34 +1000
    Re: Keeping track of things with dictionaries Chris Angelico <rosuav@gmail.com> - 2014-04-08 18:35 +1000
      Re: Keeping track of things with dictionaries Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-04-09 12:43 +1200
        Re: Keeping track of things with dictionaries Chris Angelico <rosuav@gmail.com> - 2014-04-09 12:33 +1000
          Re: Keeping track of things with dictionaries alex23 <wuwei23@gmail.com> - 2014-04-09 12:45 +1000
            Re: Keeping track of things with dictionaries Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-08 21:19 -0600
            Re: Keeping track of things with dictionaries Gene Heskett <gheskett@wdtv.com> - 2014-04-08 23:31 -0400
            Re: Keeping track of things with dictionaries Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-08 21:37 -0600
    Re: Keeping track of things with dictionaries "Frank Millman" <frank@chagford.com> - 2014-04-08 11:28 +0200
    Re: Keeping track of things with dictionaries Chris Angelico <rosuav@gmail.com> - 2014-04-08 19:34 +1000
    Re: Keeping track of things with dictionaries "Frank Millman" <frank@chagford.com> - 2014-04-08 11:41 +0200
  Re: Keeping track of things with dictionaries Gene Heskett <gheskett@wdtv.com> - 2014-04-09 05:51 -0400

csiph-web