On Wed, 13 Jan 2016 06:12 am, Bernardo Sulzbach wrote:

> I saw it in another answer. next(iter(d)) is still the winner.

Except that doesn't return the *value*, it returns the *key*.

py> d = {'key': 'value'}
py> next(iter(d))
'key'


To get the value:

py> next(iter(d.values()))
'value'

> This resembles a list just too much, making the coder's intent harder
> to understand. This is **very** subjective, of course.

I'm sorry, I don't understand what you mean by "resembles a list"? What
does? In what way?


-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to