So I want to test if a list is sorted. After reading this page, I did this:
ll = [ 0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15 ]
all(b >= a for a, b in zip(ll, ll[1:]) )
Output
<generator object <genexpr> at 0x10d9ecaa0>
Ok so all()
return a generator. But this is what the Python documentation says about all()
:
Return True if all elements of the iterable are true (or if the iterable is empty)
What am i missing?