3 ms·
Even clearer: x = [for word in words: for letter in word: letter] This also has the advantage of being readable left to right without encountering any unb
by jules 12y ago
Even clearer:
x = [for word in words: for letter in word: letter]
This also has the advantage of being readable left to right without encountering any unbound identifiers like all other constructs in Python.
- hueving 12y agoAs someone who spends a significant amount of time in python that is much harder to follow. There is an expectation for order in list comprehensions and what you wrote completely violates it.