by fvdessen · 8y ago · 0 comments
>>> { char.upper() for char in "hello" }
set(['H', 'E', 'L', 'O'])
>>> { char: ord(char) for char in "world" }
{'d': 100, 'r': 114, 'o': 111, 'w': 119, 'l': 108}
>>> (char for char in "foobar").next()
'f'From that perspective it feels more natural.