News for hackers. Stuff that matters.
Re:Ask HN: Is ease in getting started the key for Python's s... by atoav on Wednesday August 10, 2022 @03:28AM (#32408776)
What I really love about python is list comprehensions.

Instead of

  processed = []
  for part in unprocessed:
      if part.tag in ["good", "circled"]:
          processed.append(part.name)
You can do

  processed = [part.name for part in unprocessed if part.tag in ["good", "circled"]]
In one line.

There are no comments on this comment yet.