<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Python on Omar H.Ajmi | Python, Java, Terraform &amp; DevOps TILs</title>
    <link>https://omar-ajmi.de5.net/tags/python/</link>
    <description>Recent content in Python on Omar H.Ajmi | Python, Java, Terraform &amp; DevOps TILs</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Thu, 29 Oct 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://omar-ajmi.de5.net/tags/python/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>🐍 Python 3.15: Lazy Imports Without Hiding Them Inside Functions</title>
      <link>https://omar-ajmi.de5.net/posts/en/python-315-lazy-imports/</link>
      <pubDate>Thu, 29 Oct 2026 00:00:00 +0000</pubDate>
      
      <guid>https://omar-ajmi.de5.net/posts/en/python-315-lazy-imports/</guid>
      <description>&lt;h1&gt;🐍 Python 3.15: Lazy Imports Without Hiding Them Inside Functions&lt;/h1&gt;

&lt;p&gt;Ever opened a Python CLI tool that takes several seconds to start, even though you only want to display its help message?&lt;/p&gt;
&lt;p&gt;Sometimes, the application is busy loading modules it won&amp;rsquo;t actually use.&lt;/p&gt;
&lt;p&gt;Python 3.15 introduces a new option: &lt;strong&gt;explicit lazy imports&lt;/strong&gt;. Instead of loading a module immediately, Python can wait until you first use the imported name.&lt;/p&gt;
&lt;p&gt;The interesting part? Your imports can stay at the top of the file.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>🐍 Python: `is` vs. `==` — Same Value, Different Object</title>
      <link>https://omar-ajmi.de5.net/posts/en/python-is-vs-equals/</link>
      <pubDate>Mon, 05 Oct 2026 00:00:00 +0000</pubDate>
      
      <guid>https://omar-ajmi.de5.net/posts/en/python-is-vs-equals/</guid>
      <description>&lt;h1 id=&#34;-python-is-vs---same-value-different-object&#34; class=&#34;header-anchor-wrapper&#34;&gt;🐍 Python: &lt;code&gt;is&lt;/code&gt; vs. &lt;code&gt;==&lt;/code&gt; — Same Value, Different Object
  &lt;a href=&#34;#-python-is-vs---same-value-different-object&#34; class=&#34;header-anchor-link&#34;&gt;
    &lt;svg width=&#34;16px&#34; height=&#34;16px&#34; viewBox=&#34;0 0 24 24&#34;&gt;
&lt;svg
    xmlns=&#34;http://www.w3.org/2000/svg&#34;
    width=&#34;24&#34; height=&#34;24&#34; viewBox=&#34;0 0 24 24&#34; fill=&#34;none&#34;
    stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; stroke-linecap=&#34;round&#34;
    stroke-linejoin=&#34;round&#34;&gt;
    &lt;line x1=&#34;4&#34; y1=&#34;9&#34; x2=&#34;20&#34; y2=&#34;9&#34;&gt;&lt;/line&gt;&lt;line x1=&#34;4&#34; y1=&#34;15&#34; x2=&#34;20&#34; y2=&#34;15&#34;&gt;&lt;/line&gt;&lt;line x1=&#34;10&#34; y1=&#34;3&#34; x2=&#34;8&#34; y2=&#34;21&#34;&gt;&lt;/line&gt;&lt;line x1=&#34;16&#34; y1=&#34;3&#34; x2=&#34;14&#34; y2=&#34;21&#34;&gt;&lt;/line&gt;
&lt;/svg&gt;

&lt;/svg&gt;
  &lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Two lists contain exactly the same elements. You compare them, and Python says they&amp;rsquo;re equal.&lt;/p&gt;
&lt;p&gt;Then you use &lt;code&gt;is&lt;/code&gt;, and Python says they&amp;rsquo;re different.&lt;/p&gt;
&lt;p&gt;Is Python contradicting itself? Nope. You&amp;rsquo;re asking two different questions.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>🐍 Python dataclasses: the list that wanted roommates</title>
      <link>https://omar-ajmi.de5.net/posts/en/python-dataclasses/</link>
      <pubDate>Sat, 12 Sep 2026 00:00:00 +0000</pubDate>
      
      <guid>https://omar-ajmi.de5.net/posts/en/python-dataclasses/</guid>
      <description>&lt;h1 id=&#34;-python-dataclasses-the-list-that-wanted-roommates&#34; class=&#34;header-anchor-wrapper&#34;&gt;🐍 Python dataclasses: the list that wanted roommates
  &lt;a href=&#34;#-python-dataclasses-the-list-that-wanted-roommates&#34; class=&#34;header-anchor-link&#34;&gt;
    &lt;svg width=&#34;16px&#34; height=&#34;16px&#34; viewBox=&#34;0 0 24 24&#34;&gt;
&lt;svg
    xmlns=&#34;http://www.w3.org/2000/svg&#34;
    width=&#34;24&#34; height=&#34;24&#34; viewBox=&#34;0 0 24 24&#34; fill=&#34;none&#34;
    stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; stroke-linecap=&#34;round&#34;
    stroke-linejoin=&#34;round&#34;&gt;
    &lt;line x1=&#34;4&#34; y1=&#34;9&#34; x2=&#34;20&#34; y2=&#34;9&#34;&gt;&lt;/line&gt;&lt;line x1=&#34;4&#34; y1=&#34;15&#34; x2=&#34;20&#34; y2=&#34;15&#34;&gt;&lt;/line&gt;&lt;line x1=&#34;10&#34; y1=&#34;3&#34; x2=&#34;8&#34; y2=&#34;21&#34;&gt;&lt;/line&gt;&lt;line x1=&#34;16&#34; y1=&#34;3&#34; x2=&#34;14&#34; y2=&#34;21&#34;&gt;&lt;/line&gt;
&lt;/svg&gt;

&lt;/svg&gt;
  &lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;You create two objects. You update the list in one. Somehow, the other object knows about it.&lt;/p&gt;
&lt;p&gt;Congratulations: your objects are sharing. Unfortunately, nobody asked them to.&lt;/p&gt;

&lt;h2 id=&#34;-the-tiny-trap&#34; class=&#34;header-anchor-wrapper&#34;&gt;🧠 The tiny trap
  &lt;a href=&#34;#-the-tiny-trap&#34; class=&#34;header-anchor-link&#34;&gt;
    &lt;svg width=&#34;16px&#34; height=&#34;16px&#34; viewBox=&#34;0 0 24 24&#34;&gt;
&lt;svg
    xmlns=&#34;http://www.w3.org/2000/svg&#34;
    width=&#34;24&#34; height=&#34;24&#34; viewBox=&#34;0 0 24 24&#34; fill=&#34;none&#34;
    stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; stroke-linecap=&#34;round&#34;
    stroke-linejoin=&#34;round&#34;&gt;
    &lt;line x1=&#34;4&#34; y1=&#34;9&#34; x2=&#34;20&#34; y2=&#34;9&#34;&gt;&lt;/line&gt;&lt;line x1=&#34;4&#34; y1=&#34;15&#34; x2=&#34;20&#34; y2=&#34;15&#34;&gt;&lt;/line&gt;&lt;line x1=&#34;10&#34; y1=&#34;3&#34; x2=&#34;8&#34; y2=&#34;21&#34;&gt;&lt;/line&gt;&lt;line x1=&#34;16&#34; y1=&#34;3&#34; x2=&#34;14&#34; y2=&#34;21&#34;&gt;&lt;/line&gt;
&lt;/svg&gt;

&lt;/svg&gt;
  &lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Python&amp;rsquo;s ordinary class attributes can be shared between instances. Dataclasses protect against many mutable-default mistakes by rejecting unhashable defaults, including a plain list, in current Python versions.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>🐍 Python: The Mutable Default Argument Trap</title>
      <link>https://omar-ajmi.de5.net/posts/en/python-mutable-default-arguments/</link>
      <pubDate>Wed, 03 Jun 2026 00:00:00 +0000</pubDate>
      
      <guid>https://omar-ajmi.de5.net/posts/en/python-mutable-default-arguments/</guid>
      <description>&lt;h1 id=&#34;-python-the-mutable-default-argument-trap&#34; class=&#34;header-anchor-wrapper&#34;&gt;🐍 Python: The Mutable Default Argument Trap
  &lt;a href=&#34;#-python-the-mutable-default-argument-trap&#34; class=&#34;header-anchor-link&#34;&gt;
    &lt;svg width=&#34;16px&#34; height=&#34;16px&#34; viewBox=&#34;0 0 24 24&#34;&gt;
&lt;svg
    xmlns=&#34;http://www.w3.org/2000/svg&#34;
    width=&#34;24&#34; height=&#34;24&#34; viewBox=&#34;0 0 24 24&#34; fill=&#34;none&#34;
    stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; stroke-linecap=&#34;round&#34;
    stroke-linejoin=&#34;round&#34;&gt;
    &lt;line x1=&#34;4&#34; y1=&#34;9&#34; x2=&#34;20&#34; y2=&#34;9&#34;&gt;&lt;/line&gt;&lt;line x1=&#34;4&#34; y1=&#34;15&#34; x2=&#34;20&#34; y2=&#34;15&#34;&gt;&lt;/line&gt;&lt;line x1=&#34;10&#34; y1=&#34;3&#34; x2=&#34;8&#34; y2=&#34;21&#34;&gt;&lt;/line&gt;&lt;line x1=&#34;16&#34; y1=&#34;3&#34; x2=&#34;14&#34; y2=&#34;21&#34;&gt;&lt;/line&gt;
&lt;/svg&gt;

&lt;/svg&gt;
  &lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;You write a function that collects items into a list. The first call works perfectly. The second call mysteriously contains items from the first.&lt;/p&gt;
&lt;p&gt;No global variable. No database. No spooky background thread.&lt;/p&gt;
&lt;p&gt;Just a Python default argument doing exactly what it was designed to do.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>🐍 Python 3.14: t-Strings Look Like f-Strings, But They Aren&#39;t Strings</title>
      <link>https://omar-ajmi.de5.net/posts/en/python-t-strings/</link>
      <pubDate>Tue, 21 Oct 2025 00:00:00 +0000</pubDate>
      
      <guid>https://omar-ajmi.de5.net/posts/en/python-t-strings/</guid>
      <description>&lt;h1 id=&#34;-python-314-t-strings-look-like-f-strings-but-they-arent-strings&#34; class=&#34;header-anchor-wrapper&#34;&gt;🐍 Python 3.14: t-Strings Look Like f-Strings, But They Aren&amp;rsquo;t Strings
  &lt;a href=&#34;#-python-314-t-strings-look-like-f-strings-but-they-arent-strings&#34; class=&#34;header-anchor-link&#34;&gt;
    &lt;svg width=&#34;16px&#34; height=&#34;16px&#34; viewBox=&#34;0 0 24 24&#34;&gt;
&lt;svg
    xmlns=&#34;http://www.w3.org/2000/svg&#34;
    width=&#34;24&#34; height=&#34;24&#34; viewBox=&#34;0 0 24 24&#34; fill=&#34;none&#34;
    stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; stroke-linecap=&#34;round&#34;
    stroke-linejoin=&#34;round&#34;&gt;
    &lt;line x1=&#34;4&#34; y1=&#34;9&#34; x2=&#34;20&#34; y2=&#34;9&#34;&gt;&lt;/line&gt;&lt;line x1=&#34;4&#34; y1=&#34;15&#34; x2=&#34;20&#34; y2=&#34;15&#34;&gt;&lt;/line&gt;&lt;line x1=&#34;10&#34; y1=&#34;3&#34; x2=&#34;8&#34; y2=&#34;21&#34;&gt;&lt;/line&gt;&lt;line x1=&#34;16&#34; y1=&#34;3&#34; x2=&#34;14&#34; y2=&#34;21&#34;&gt;&lt;/line&gt;
&lt;/svg&gt;

&lt;/svg&gt;
  &lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;An f-string takes your variables and glues them into a string immediately. That&amp;rsquo;s lovely for greetings and terrible for SQL, HTML and shell commands, where &amp;ldquo;just glue it&amp;rdquo; is how injection bugs are born.&lt;/p&gt;</description>
    </item>
    
  </channel>
</rss>