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


Groups > comp.lang.python > #43835 > unrolled thread

Re: Working with lists within Dictionaries

Started byChris Angelico <rosuav@gmail.com>
First post2013-04-19 00:38 +1000
Last post2013-04-19 00:38 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#43835 — Re: Working with lists within Dictionaries

FromChris Angelico <rosuav@gmail.com>
Date2013-04-19 00:38 +1000
SubjectRe: Working with lists within Dictionaries
Message-ID<mailman.775.1366295908.3114.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web