@paarth@pirate.lgbt avatar

paarth

@paarth@pirate.lgbt

🏳️‍🌈 Bi/pan, poly, cis man, and disappointed optimist.

👨🏾‍💻 I'm the admin of #mastodon, #matrix, and #homeassistant servers, and work as a Staff Software Engineer in Silicon Valley.
✍🏾 Aspiring writer, and nearly done™ editing my 155k word science fantasy novel.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

ehmatthes, to python
@ehmatthes@fosstodon.org avatar

TIL how to use itertools.dropwhile() to get all lines from a file after a specific line. I always used to write my own loop to solve this problem.

I'm curious, have you heard of dropwhile()? Have you used it?

paarth,
@paarth@pirate.lgbt avatar

@AlSweigart @ehmatthes itertools and functools take the crown for each being parts of the standard library that are grossly underused. They solve so, so many common programming patterns in a way that is measurably more performant than other solutions.

You want to have a for loop within a for loop? You can use itertools.product instead!
You want memoization of a function/instance property? Just use functools.cache, or functools.cached_property respectively!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • kavyap
  • DreamBathrooms
  • khanakhh
  • magazineikmin
  • InstantRegret
  • tacticalgear
  • thenastyranch
  • Youngstown
  • rosin
  • slotface
  • modclub
  • everett
  • ngwrru68w68
  • anitta
  • Durango
  • osvaldo12
  • normalnudes
  • cubers
  • ethstaker
  • mdbf
  • tester
  • GTA5RPClips
  • cisconetworking
  • Leos
  • megavids
  • provamag3
  • lostlight
  • All magazines