Another dict method...

Thomas Wouters thomas at xs4all.net
Wed May 23 15:41:20 EDT 2001


On Sat, May 19, 2001 at 09:29:27AM -0700, Emile van Sebille wrote:

> 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 dict.next might do.  Looking closer, I see that not even
> bsddb.hashopen.next returns keys in sorted order.

Note that Tim said 'dict.iteritems().next()', not 'dict.next()'.
'dict.iteritems()' returns (in the current CVS tree and probably in Python
2.2, when it's released) an iterator object that iterates over the items of
a dictionary. Iterators have a 'next' method that returns, oddly enough, the
next value (of whatever the iterator is iterating over.)

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list