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

David Crisp dcrisp at netspace.net.au
Fri Mar 14 01:27:21 CET 2014


Thanks everyone,

I have examined the way I was writing my code and .. Bulk deleted the 
entire block that was causing the problem with the intention of re-writing 
it! :)

Okay:  SO i had a look at what I was doing and realsied it was slightly 
regressive so I am having another look at my structure!

Regards,
David Crisp



On Fri, 14 Mar 2014, Javier Candeira wrote:

> On Fri, Mar 14, 2014 at 10:31 AM, Jason King <pizza at netspace.net.au> wrote:
>
>> yup, associative arrays , (in awk), dicts in python , and the perl version
>> of them are all like this, you can't specify the order in which the
>> contents are output.
>>
>> There is an OrderedDict (http://docs.python.org/2/
>> library/collections.html#collections.OrderedDict)
>> if insertion order is important to you.
>
>
> And, to add to Jason's Rosetta Stone of mappings, I believe Ruby hashes
> (which is the name dicts have in that faraway land) are always ordered, at
> least from 1.9 onwards.
>
> J
>


More information about the melbourne-pug mailing list