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


Groups > comp.lang.python > #9716

Re: Ordered list question

References <20110717162845.UI3PT.43294.root@cdptpa-web23-z02>
Date 2011-07-18 02:38 +1000
Subject Re: Ordered list question
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1175.1310920684.1164.python-list@python.org> (permalink)

Show all headers | View raw


On Mon, Jul 18, 2011 at 2:28 AM,  <jyoung79@kc.rr.com> 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

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


Thread

Re: Ordered list question Chris Angelico <rosuav@gmail.com> - 2011-07-18 02:38 +1000

csiph-web