Let’s say you have a Map-compatible object in Java, or a dict-like object in Python.
You know (or assume) that it has just one key/value pair in it. You want to assign the items to attributes of a class.
(outRow.key, outRow.value), = res.iteritems()
Map.Entry kv = res.values().toArray(); outRow.key = kv.key; outRow.value = kv.value;
It’s not really the two extra lines, though that’s also annoying as hell. It’s the “.values().toArray()” replacing “.iteritems()” and a trailing comma on the other side of the assignment.
In Python, Guido viewed it as *too verbose*, and so in Python 3K, it’s just .items(), without the iter. The Java thing is frustrating because it is actually *cooler* than Python (.values() is a view, just like Python 3K has and Python doesn’t) but so much less comfortable.