[Python-ideas] Integrate some itertools into the Python syntax
Nikolaus Rath
Nikolaus at rath.org
Fri Mar 25 12:53:13 EDT 2016
On Mar 25 2016, Michel Desmoulin <desmoulinmichel-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org> wrote:
> It's also very convenient for generator expressions:
>
> # get random numbers between 0 and 100000, and square them
> # remove all numbers you can't devide by 3
> # then sample 100 of them
>
> numbers = (x * x for x in random.randint(100000) if x % 3 == 0)
> for x in numbers[:100]:
> print(x)
If there has ever been an example that I hope to never, ever see in
actual code than it's this one. If you have to make up stuff like that
to justify a proposed feature, then that does not bode well.
Best,
-Nikolaus
--
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F
»Time flies like an arrow, fruit flies like a Banana.«
More information about the Python-ideas
mailing list