[BangPypers] Dictionary : An elementary question

Jeffrey Jose jeffjosejeff at gmail.com
Thu Aug 19 21:10:37 CEST 2010


On Thu, Aug 19, 2010 at 10:26 AM, Dipo Elegbede <delegbede at dudupay.com>wrote:

> Hi All,
> There really shouldn't be so much debate on the question asked.
> Someone actually gave a direct and clear answer. I'm new at python and
> his explanations were quite understandable.
>

I'm sorry that you sensed a debate in what happened to the question.
Personally I find it very refreshing when people contribute with different
ideas.
In this particular case, Shaswat Anand's reply of what OrdererdDicts are
(BSTs) was actually a new information to me. Had we closed the question the
moment we sense a right answer, I wouldnt have known that.


> If you call the d.keys() consecutively, you might get two different orders.
>

I dont think  it works the way you say it. d.keys() *should* return the same
way no matter how many times you call it. If the dictionary (d) changes in
between - because of the way HashTables/HashMaps are implemented - you are
bound to get in a different order.

*Long story short. *d.keys() will return the same thing if d doesnt change.


/jeff


More information about the BangPypers mailing list