Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by __MatrixMan__

2 years ago

At least in my code, these nested loop thingies are rarely unique. If I have to do it once I probably have to do it many times. If I'm being mindful, I stop repeating myself and just write a generator so that I can invoke it like:

  [foo(x) for x in nonempty(bar_mat)]

Mostly this is because I live in fear of ruff's complexity warning, C901.

0 comments

__MatrixMan__

Reply

No comments yet

Contribute on Hacker News ↗

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities