Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsreader4.netcologne.de!news.netcologne.de!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'python': 0.08; 'am,': 0.13; 'received:209.85.214.174': 0.13; 'received:mail- iw0-f174.google.com': 0.13; 'wrote:': 0.15; '2:28': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'mon,': 0.16; 'subject:list': 0.16; 'subject:question': 0.21; 'this?': 0.22; 'header:In-Reply-To:1': 0.22; 'dictionary': 0.23; "i'm": 0.27; 'sort': 0.28; 'received:209.85.214': 0.28; 'message- id:@mail.gmail.com': 0.28; 'chris': 0.32; 'list': 0.32; 'does': 0.32; 'it.': 0.33; 'to:addr:python-list': 0.34; 'option.': 0.35; 'probably': 0.35; 'question': 0.35; 'similar': 0.37; 'assuming': 0.37; 'but': 0.37; 'could': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'something': 0.38; 'think': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.40; 'beforehand': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=5BAMcUAR1f5OZBuHpbozLfOhB0YcOtpkI6SYpd26Eps=; b=eD2n3qWPDXNIm1PXG6vEu2hBN2hYzdAqkQc6fnginf0eaBxS6MtkuMp21SU6ZOpfzE aD+Wr/wzQD4dntyJ6/KNJaq0GwPSuRry+tnnsq1On1GeK2hiL7irzf8xgcNG0f2sF1oV t4SZp7F7zEkWpQv22f91AGf82sluzCWgqlv2I= MIME-Version: 1.0 In-Reply-To: <20110717162845.UI3PT.43294.root@cdptpa-web23-z02> References: <20110717162845.UI3PT.43294.root@cdptpa-web23-z02> Date: Mon, 18 Jul 2011 02:38:01 +1000 Subject: Re: Ordered list question From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1310920684 news.xs4all.nl 23850 [2001:888:2000:d::a6]:59048 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:9716 On Mon, Jul 18, 2011 at 2:28 AM, wrote: > My question is, does python have a similar way to do something like this? > I'm assuming the best way is to create a dictionary and then sort it by > the keys? > That would be one way to do it. If you know beforehand what the highest ID is, you could create a list and treat it exactly the way you're treating the Javascript array, but I think the dictionary is probably a better option. Chris Angelico