grahamboree,
@grahamboree@mastodon.gamedev.place avatar

Super "fun" bug: groupby in itertools ostensibly groups items by the result of a key function, however it just groups similar sequential items in the input list. You can't safely use it directly to build a dictionary. It will silently drop some of your items.

>>> data = ['aa', 'bbb', 'cc']
>>> grouped = {k: list(v) for k, v in groupby(data, key=len)}
>>> print(grouped)
{2: ['cc'], 3: ['bbb']}

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