<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Itertools on Nalar</title>
    <link>https://nalar.dev/tags/itertools/</link>
    <description>Recent content in Itertools on Nalar</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 08 Sep 2026 00:00:00 +0700</lastBuildDate>
    <atom:link href="https://nalar.dev/tags/itertools/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Compare Neighboring Values Lazily with itertools.pairwise</title>
      <link>https://nalar.dev/compare-neighboring-values-lazily-with-itertools-pairwise/</link>
      <pubDate>Tue, 08 Sep 2026 00:00:00 +0700</pubDate>
      <guid>https://nalar.dev/compare-neighboring-values-lazily-with-itertools-pairwise/</guid>
      <description>&lt;p&gt;Many data-processing tasks are really questions about transitions: Did a measurement increase? How long was the gap between two events? Did a state change? Is a sequence sorted? These problems need neighboring values, not arbitrary pairs.&lt;/p&gt;&#xA;&lt;p&gt;Python 3.10 added &lt;code&gt;itertools.pairwise()&lt;/code&gt; for exactly this pattern. It produces overlapping adjacent pairs lazily, which makes the intent clearer than manual indexing and lets the same code work with lists, generators, files, and other iterables.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
