Python Array

Jussi Piitulainen jussi.piitulainen at helsinki.fi
Thu Mar 31 01:57:44 EDT 2016


Stephen Hansen writes:

> On Wed, Mar 30, 2016, at 10:34 PM, tdsperth at gmail.com wrote:
>> as you can see the option element was added third but is the first one
>> displayed.
>> 
>> Is this just standard - I am using Python 3.5
>
> The order of items in dictionaries is based on the hash value -- which
> while stable, should be considered random and not reliable. If you want
> to maintain insertion order, consider using an OrderedDict:
>
> https://docs.python.org/3.5/library/collections.html#collections.OrderedDict

Possibly collections.namedtuple for database records.



More information about the Python-list mailing list