[Python-ideas] Generator syntax hooks?
Steven D'Aprano
steve at pearwood.info
Mon Aug 7 19:35:37 EDT 2017
Hi Soni, and welcome!
On Mon, Aug 07, 2017 at 04:30:05PM -0300, Soni L. wrote:
> What if, (x for x in integers if 1000 <= x < 1000000), was syntax sugar
> for (x for x in range(1000, 1000000))?
If you want the integers from 1000 to 1000000, use:
range(1000, 1000000)
Don't waste your time slowing down the code with an unnecessary and
pointless wrapper that does nothing but pass every value on unchanged:
(x for x in range(1000, 1000000)) # waste of time and effort
--
Steve
More information about the Python-ideas
mailing list