xavdid,
@xavdid@mastodon.social avatar

Happy 3.12 day! There are a lot of improvements, but my favorite is the arrival of itertools.batched(iterable, n):

> Batch data from the iterable into tuples of length n. The last batch may be shorter than n.

Such a useful function!

docs: https://docs.python.org/3.12/library/itertools.html#itertools.batched

mpirnat,
@mpirnat@mas.to avatar

@xavdid I am almost unreasonably excited about this.

grantmc,
@grantmc@techhub.social avatar

@xavdid This is a function I end up writing myself in all of my projects.😄 Glad to see they added it to the standard lib!

tshirtman,
@tshirtman@mas.to avatar

@grantmc @xavdid same, and at least once I got it wrong, and I’ve seen inefficient implementations in the wild, good to get it for free!

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