Nadeem Vawda <[email protected]> added the comment: > "popitem() > Remove and return an arbitrary (key, value) pair from the dictionary. Raises > KeyError if the dict is empty. Use next(iter(d)) to return an arbitrary pair > without removing it."
Actually, next(iter(d)) on a dict returns an arbitrary *key*; if you want a pair, you need next(iter(d.items())). ---------- nosy: +nadeem.vawda _______________________________________ Python tracker <[email protected]> <http://bugs.python.org/issue14836> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
