using all
, I understand this for example:
l = [1, 2, 3, 4, 5, 6]
all([n > 0 for n in l])
all takes an iterable, all good.
how come this works (no square brackets, no list comprehension):
all(n > 0 for n in l)
but this doesn't work (calling it without all
):
n > 0 for n in l
(SyntaxError)
and obviously, this works:
[n > 0 for n in l]
What's happening when calling any, why is it taking n > 0 for n in l
as an iterable?
Thanks!