Comment

Comment by tuvistavie

I am not sure I would advocate for this but, from Python 3.8, this is an instance where assignment expressions could allow the first code without duplication.

    first(x * y
          for x in nums
          if (y := 2020 - x) in nums and x != y)
parent tuvistavie 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton