Try using reduce
.
reduce(lambda x, y: x == y, items)
Oh, I'm angry if it's an empty list, so I have to set the initial value ...
print reduce(lambda x, y: x == y, [])
# TypeError: reduce() of empty sequence with no initial value
print reduce(lambda x, y: x == y, [], True)
... ʻis` would be more refreshing if it were a function.
Postscript You pointed out in a short time. Or rather, if you think about it for a moment, this is no good ... orz
I made a mistake because it was the first time I thought I should post it as a trial Let's keep it as a commandment ...
Postscript When I thought that it would not be viewed at all, I was pointed out for a while, Qiita is amazing ... The title and content are so different that I changed the title of this article and created New Article.