yield
statement inside a comprehension PTC-W0025Do not use yield
inside a comprehension as it will return a generator object.
Use a generator expression instead.
Note: Use of yield
inside a comprehension was allowed till Python 3.7 but is a syntax error from Python 3.8 onwards.
number_generator = [(yield num) for num in range(1,1000)]
number_generator = (num for num in range(1,1000))