Comment

Comment by CBLT

Can someone who's better at Python than me chime in, isn't the obvious transformation of

    def square_vals(x : list):
        return [val * val for val in x]
into a generator to instead write

    def square_vals(x : list):
        return (val * val for val in x)
Does the yield syntax actually impact the performance metrics here?
parent CBLT 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton