<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Protocols on Nalar</title>
    <link>https://nalar.dev/tags/protocols/</link>
    <description>Recent content in Protocols on Nalar</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 01 Sep 2026 00:00:00 +0700</lastBuildDate>
    <atom:link href="https://nalar.dev/tags/protocols/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Python Protocols and Structural Subtyping for Flexible APIs</title>
      <link>https://nalar.dev/python-protocols-and-structural-subtyping/</link>
      <pubDate>Tue, 01 Sep 2026 00:00:00 +0700</pubDate>
      <guid>https://nalar.dev/python-protocols-and-structural-subtyping/</guid>
      <description>&lt;p&gt;Python code often depends on behavior rather than a specific class hierarchy. A function may only need an object with a &lt;code&gt;send()&lt;/code&gt; method, a &lt;code&gt;read()&lt;/code&gt; method, or a pair of repository operations.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;typing.Protocol&lt;/code&gt; lets type checkers describe those behavioral requirements directly. A class satisfies a protocol by having compatible members; it does not need to inherit from the protocol.&lt;/p&gt;&#xA;&lt;p&gt;This is structural subtyping: &amp;ldquo;if it has the required shape, it can be used here.&amp;rdquo;&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
