Ian Kelly wrote:
On Fri, May 6, 2011 at 1:57 PM, dmitrey <dmitre...@gmail.com> wrote:
Unfortunately, it doesn't work, it turn out to be dict_items:
next({1:2}.items())
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
TypeError: dict_items object is not an iterator

So call iter() on it first:

next(iter(myDict.items()))

Which is becoming less elegant. Seems to me that View objects should be directly iterable, but then I don't really understand the motivation behind them or what greatness is facilitated by having them.

Anybody care to chime in with their usage of this construct?

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to