« * K @trey.io

Trey Hunner @trey.io

2026-11-24 04:16 UTC

It's handy for comparing each item to the next one, like how much temperature changes between readings: >>> temperatures = [49, 52, 58, 55, 55, 60] >>> [n - m for m, n in pairwise(temperatures)] [3, 6, -3, 0, 5] pairwise was added in Python 3.10, and it works on ANY iterable, even iterators.

A reply in a thread.

0 likes, 0 reposts, 1 replies

3 Next post4 More from @trey.ioBackBluesky home
☆ Save to home · 0 Home · Find · Games · Chat · AI · Setup