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


Groups > comp.lang.python > #43835

Re: Working with lists within Dictionaries

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.153
X-Spam-Level *
X-Spam-Evidence '*H*': 0.70; '*S*': 0.01; 'append': 0.09; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'message-id:@mail.gmail.com': 0.30; 'subject:with': 0.35; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'something': 0.35; 'subject:lists': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'indexed': 0.36; 'list': 0.37; 'received:209': 0.37; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'structure': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'is.': 0.60; 'simply': 0.61; 'itself?': 0.84; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=ejLi02GgUJUDuE0iywDzcHsxH4Yco7I57PRZuAC2NV8=; b=xvsO3WxErUrbDZg57WzqBH66TIQcV9B70QWgF3gFSXMZa1GBju94e78frA+EBn4/7J 3r19uaV3Dg6MJwoHUORsH3QXdwucQRY99h8muUuUEOB79RK6BXHVPo1OIajKzh1h6AjB 8GPZ51SCiJkcLv67jtUswB5j3kuGbFNa5hYYVgtlWeLCoh5K8wI2tB1SbI6bNASv357M xia26yHvxIwJ98TR3vo0Q5m6680bg8RTf0fErFEwEYxPhdAyE2eTnByDCoR0sOte87I9 0ssHeirHzTXwQRWBBGqql9ti8srRtt4JtmgE2896iT7XYfLphINZd5V7flBhayWj4z2H YcSw==
MIME-Version 1.0
X-Received by 10.220.125.74 with SMTP id x10mr2427594vcr.7.1366295899906; Thu, 18 Apr 2013 07:38:19 -0700 (PDT)
In-Reply-To <CAFqGZRHSuNx=A67j-+mT0Ahv0hgzyZPOesozy5A4SJZs-n-f7g@mail.gmail.com>
References <CAFqGZRHSuNx=A67j-+mT0Ahv0hgzyZPOesozy5A4SJZs-n-f7g@mail.gmail.com>
Date Fri, 19 Apr 2013 00:38:19 +1000
Subject Re: Working with lists within Dictionaries
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.15
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.775.1366295908.3114.python-list@python.org> (permalink)
Lines 10
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1366295908 news.xs4all.nl 2182 [2001:888:2000:d::a6]:38337
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:43835

Show key headers only | View raw


On Thu, Apr 18, 2013 at 11:58 PM, inshu chauhan <insideshoes@gmail.com> wrote:
> segments.setdefault(reg_num, [])[point] += point

Not sure what your desired structure is. This is seeking to add the
point to something indexed by the point; perhaps you simply want to
append to the list itself?

segments.setdefault(reg_num, []).append(point)

ChrisA

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


Thread

Re: Working with lists within Dictionaries Chris Angelico <rosuav@gmail.com> - 2013-04-19 00:38 +1000

csiph-web