[melbourne-pug] dicts not always printing (and thus processing) in the same order they were created in (or, Im doing it WRONG ????)

Ben Finney ben+python at benfinney.id.au
Fri Mar 14 00:40:49 CET 2014


David Crisp <dcrisp at netspace.net.au> writes:

> I am reading the ROW in, placing it in a container and then later
> writing that row out in the same order it got loaded in on.  THis
> order creates the EAV rows in their correct order.   If the data goes
> out in a different order to when it came in then the EAV rows are
> written in the incorrect order and the data goes bad.

I would suggest, then, that you need only sequential access to this
collection; you don't need key-based access. You don't need a ‘dict’
(nor even an OrderedDict) if access by arbitrary key is not needed.

So, you can use a list of tuples, where each tuple is a record. The
order of records will be preserved.

-- 
 \          “What I have to do is see, at any rate, that I do not lend |
  `\      myself to the wrong which I condemn.” —Henry Thoreau, _Civil |
_o__)                                                    Disobedience_ |
Ben Finney



More information about the melbourne-pug mailing list