Another dict method...

Emile van Sebille emile at
Sat May 19 12:29:27 EDT 2001

Sorry.  My confusion.  I sometimes use bsddb.btopen like a persistent dict,
and it's .next does return in sorted order, so I transferred the thinking to
what might do.  Looking closer, I see that not even returns keys in sorted order.

I'll just remember that next means another and doesn't imply ordering.

then-why-not-use-prior-ly y'rs


Emile van Sebille
emile at

"Tim Peters" < at> wrote in message
news:mailman.990250527.29319.python-list at
> [Emile van Sebille, about the 2.2 dict.iteritems() iterator]
> > Yes.  Can it retrieve them in sorted order?
> No.  The order of retrieval is undefined.  It's not magic, it's fast
> The only sort gimmick of any kind in the language is list.sort().
> > I also see a clear method.  Is there an advantage in using it over
> > reassigning to a new {} ?
> dict.clear() clears the dict in-place, without creating a new object.
> Whether that's what you want depends on whether you want aliases (other
> of getting to the object besides via the name "dict") to see the effect of
> the clear too.

More information about the Python-list mailing list