<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Boilerplate on Alra</title><link>https://alra.dev/tags/boilerplate/</link><description>Recent content in Boilerplate on Alra</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Wed, 19 Aug 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://alra.dev/tags/boilerplate/index.xml" rel="self" type="application/rss+xml"/><item><title>Python Dataclasses Explained: Concepts, Code, and Real-World Use</title><link>https://alra.dev/posts/python-dataclasses-explained-concepts-code-and-real-world-use/</link><pubDate>Wed, 19 Aug 2026 00:00:00 +0000</pubDate><guid>https://alra.dev/posts/python-dataclasses-explained-concepts-code-and-real-world-use/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;When a Python class exists primarily to represent data, we often write repetitive code. We need to define &lt;code&gt;__init__()&lt;/code&gt;, assign attributes, implement &lt;code&gt;__repr__()&lt;/code&gt; for debugging, and often implement &lt;code&gt;__eq__()&lt;/code&gt; to compare objects.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Dataclasses&lt;/strong&gt; reduce this boilerplate and make the intent of the class more explicit.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="what-are-dataclasses"&gt;What are Dataclasses?&lt;/h2&gt;
&lt;p&gt;A &lt;strong&gt;Dataclass&lt;/strong&gt; is a regular class processed by the &lt;code&gt;@dataclass&lt;/code&gt; decorator. The decorator examines type annotations and adds generated methods such as &lt;code&gt;__init__()&lt;/code&gt;, &lt;code&gt;__repr__()&lt;/code&gt;, and &lt;code&gt;__eq__()&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>