I am confused why this code works. In a call to all() I can use syntax which appears like code to generate a list comprehension, but without any parentheses other than the pair for the argument list. Executing the same code outside the argument list results in a syntax error. Calling print on the same code results in the creation of a generator, but without using yield or the (generator comprehension parentheses) ?
Is this special syntax applicable to only function calls, or am I missing something?
all(i for i in range(1, 11))
# True
print(i for i in range(1, 11))
# the syntax is creating a generator?
# <generator object <genexpr> at 0x00000000CDD7CC00>
i for i in range(1,11)
# ^
# SyntaxError: invalid syntax