<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Immutability on Nalar</title>
    <link>https://nalar.dev/tags/immutability/</link>
    <description>Recent content in Immutability on Nalar</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 09 Sep 2026 00:00:00 +0700</lastBuildDate>
    <atom:link href="https://nalar.dev/tags/immutability/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Update Immutable Records with Python copy.replace()</title>
      <link>https://nalar.dev/update-immutable-records-with-copy-replace/</link>
      <pubDate>Wed, 09 Sep 2026 00:00:00 +0700</pubDate>
      <guid>https://nalar.dev/update-immutable-records-with-copy-replace/</guid>
      <description>&lt;p&gt;I like immutable value objects because they make state changes explicit. The awkward part is that Python has historically offered several different ways to create a slightly modified version of one.&lt;/p&gt;&#xA;&lt;p&gt;A dataclass has &lt;code&gt;dataclasses.replace()&lt;/code&gt;. A named tuple has &lt;code&gt;_replace()&lt;/code&gt;. A custom class usually needs its own helper. The operations are conceptually similar, but generic code has no single interface to target.&lt;/p&gt;&#xA;&lt;p&gt;Python 3.13 adds &lt;code&gt;copy.replace()&lt;/code&gt; to close that gap. It creates a new object of the same type while replacing selected fields, and it works with dataclasses, named tuples, and classes that implement &lt;code&gt;__replace__()&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
