<?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 Signal &amp; Syntax</title><link>https://signal-and-syntax.com/tags/python/</link><description>Recent content in Python on Signal &amp; Syntax</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 01 Apr 2026 06:00:00 -0700</lastBuildDate><atom:link href="https://signal-and-syntax.com/tags/python/index.xml" rel="self" type="application/rss+xml"/><item><title>Implementing a Minimal Transformer in PyTorch</title><link>https://signal-and-syntax.com/posts/minimal-transformer/</link><pubDate>Wed, 01 Apr 2026 06:00:00 -0700</pubDate><guid>https://signal-and-syntax.com/posts/minimal-transformer/</guid><description>In 2017, Vaswani et al. published &amp;ldquo;Attention Is All You Need,&amp;rdquo; a paper that quietly rearranged the entire landscape of machine learning. It introduced the Transformer architecture — a design that has since become the backbone of every major language model you&amp;rsquo;ve heard of: GPT, BERT, Claude, Gemini, and dozens of others. The paper&amp;rsquo;s title was a provocation. Attention mechanisms already existed. The claim was that you could throw out recurrence entirely and let attention carry the whole load.</description></item><item><title>The Wreck of the Edmund Fitzgerald: Modeling Decomposition in Extreme Environments</title><link>https://signal-and-syntax.com/posts/edmund-fitzgerald/</link><pubDate>Sun, 30 Nov 2025 06:00:00 -0700</pubDate><guid>https://signal-and-syntax.com/posts/edmund-fitzgerald/</guid><description>Originally appearing on his 1976 album, Summertime Dream, &amp;ldquo;The Wreck of the Edmund Fitzgerald&amp;rdquo; is a powerful ballad written and performed by folk singer Gordon Lightfoot . In 1976, the song hit No. 1 in Canada on the RPM chart, and No. 2 in the United States on the Billboard Hot 100. The lyrics are a masterpiece, but there was one specific line that always stood out to me: &amp;ldquo;The lake, it is said, never gives up her dead.</description></item><item><title>The Birthday Paradox in Production: When Random IDs Collide</title><link>https://signal-and-syntax.com/posts/birthday-paradox/</link><pubDate>Fri, 28 Nov 2025 06:00:00 -0700</pubDate><guid>https://signal-and-syntax.com/posts/birthday-paradox/</guid><description>You generate a UUID. It&amp;rsquo;s 128 bits total, with 122 bits of randomness ( Davis et al., 2024 ). That&amp;rsquo;s 340 undecillion possible values. Collision-proof, right? Your system generates a million IDs per second. Still safe? What about a billion?
As I like to say, common sense and intuition are the enemies of science. Common sense tells you that with 340,000,000,000,000,000,000,000,000,000,000,000,000 possible values, you&amp;rsquo;d need to generate at least trillions before worrying about duplicates.</description></item><item><title>Rethinking the Three-Second Traffic Rule: When Physics Says It’s Not Enough</title><link>https://signal-and-syntax.com/posts/safe-distance-in-traffic/</link><pubDate>Thu, 23 Oct 2025 09:00:00 -0700</pubDate><guid>https://signal-and-syntax.com/posts/safe-distance-in-traffic/</guid><description>While researching why car insurance rates are so extremely high in Las Vegas, I started thinking about the three-second rule and its validity. As I&amp;rsquo;ve always heard, the three-second rule refers to how far you should be behind a car in traffic. The idea is that you pick out a fixed roadside marker and you are supposed to pass that marker at least three seconds after the car in front of you.</description></item><item><title>Modeling Heat Capacity and Evaporation with Python: Why Water Warms Slowly but Cools Fast</title><link>https://signal-and-syntax.com/posts/thermo-water-energy-balance/</link><pubDate>Sun, 12 Oct 2025 09:00:00 -0700</pubDate><guid>https://signal-and-syntax.com/posts/thermo-water-energy-balance/</guid><description>Every summer, it feels like a small miracle when the pool finally warms up enough to swim. In Nevada, where the air temperature can sit above 100°F (38°C) for weeks, you&amp;rsquo;d expect the water to keep pace. Yet, somehow, it takes forever to warm, and only a few cool nights can undo all that progress.
The same phenomenon shows up in a stick of butter. Butter melts quickly, while margarine stays stubbornly firm even under the same heat.</description></item><item><title>Numeric Parsing in Python with Integer Division and Modulus</title><link>https://signal-and-syntax.com/posts/python-integer-division-and-modulus/</link><pubDate>Wed, 17 Sep 2025 13:00:00 -0700</pubDate><guid>https://signal-and-syntax.com/posts/python-integer-division-and-modulus/</guid><description>numbers with // and % for speed and clarity.&amp;quot;
}}
When you need to parse a number, the first instinct is often to convert it to a string and slice it. That works well for data that comes from people — like phone numbers, credit cards, or postal codes — where formatting and leading zeros matter. But when you are working with raw numeric data that is guaranteed to be fixed-width and free of formatting, numeric parsing with integer division (//) and modulus (%) is the better option.</description></item><item><title>Using SymPy in Python When NumPy Isn't Enough</title><link>https://signal-and-syntax.com/posts/python-sympy-vs-numpy/</link><pubDate>Fri, 05 Sep 2025 11:45:00 -0700</pubDate><guid>https://signal-and-syntax.com/posts/python-sympy-vs-numpy/</guid><description>Most of us reach for NumPy whenever math shows up in a project. But sometimes, you don&amp;rsquo;t want approximate answers, you want exact math. That&amp;rsquo;s when you pull SymPy out of your programmer&amp;rsquo;s toolkit and get to work.
It&amp;rsquo;s easy to think of SymPy only in academic terms, like running physics simulations where small rounding errors can snowball into nonsense, or checking algebraic identities where a value such as 0.0000001 should really be treated as exactly 0.</description></item><item><title>The Five-Second Rule Explored with Math &amp; Python</title><link>https://signal-and-syntax.com/posts/five-second-rule/</link><pubDate>Thu, 04 Sep 2025 06:00:00 -0700</pubDate><guid>https://signal-and-syntax.com/posts/five-second-rule/</guid><description>You know the story: drop a cookie on the kitchen floor, swoop in before five seconds are up, and declare it safe. It is comforting. It is also wrong ( Dawson et al., 2007 ; Miranda &amp;amp; Schaffner, 2016 ).
The truth is much more interesting than the myth. Germs do transfer gradually, but they are especially fast at the beginning. That means if you want to know whether your floor-cookie is still edible, you need to think in curves, not in timers.</description></item><item><title>The Meeting Diet: An Optimization Approach to Your Calendar</title><link>https://signal-and-syntax.com/posts/meeting-diet/</link><pubDate>Thu, 28 Aug 2025 05:00:00 -0700</pubDate><guid>https://signal-and-syntax.com/posts/meeting-diet/</guid><description>Every week your calendar fills with more meeting invites than you can reasonably handle. Which ones are worth the time and energy, and which should you politely decline? What if there was a way to quantify that choice?
The good news: math can help. By modeling your schedule as a 0/1 knapsack problem with two constraints ( Kellerer et al., 2004 ), you can treat meetings like items with value, time cost, and energy cost.</description></item><item><title>Using Python Dispatch Tables for Cleaner Validation</title><link>https://signal-and-syntax.com/posts/python-dispatch-maps/</link><pubDate>Fri, 22 Aug 2025 10:38:20 -0700</pubDate><guid>https://signal-and-syntax.com/posts/python-dispatch-maps/</guid><description>Let&amp;rsquo;s be honest: argument validation code is rarely the proudest part of anyone&amp;rsquo;s repo.
Most of us start with the usual suspects:
❌ The dreaded inverted-V tower of if/else statements
❌ A graveyard of guard clauses scattered line after line
Both work fine… until they don&amp;rsquo;t. Then you&amp;rsquo;re left maintaining a wall of conditionals that feels like it was designed by a committee of goblins.
There&amp;rsquo;s a better way: dispatch tables!</description></item><item><title>From Ice Shows to Algorithms: Cracking the Truck-Packing Problem</title><link>https://signal-and-syntax.com/posts/three-d-packing/</link><pubDate>Wed, 20 Aug 2025 09:00:00 -0700</pubDate><guid>https://signal-and-syntax.com/posts/three-d-packing/</guid><description>My first full-time programming job was for Holiday on Ice, an international ice show. While I focused mainly on back office systems such as accounting, itinerary, and box office reporting, I knew that one of the biggest technical challenges faced by the show&amp;rsquo;s crew was efficiently loading trucks for the next city.
One day, the controller asked me if I could code a system that took, as input, the trucks&amp;rsquo; 3D dimensions and the 3D dimensions (and weight) of every object to be packed.</description></item><item><title>Should You Walk or Run in the Rain? The Puzzle That Sparked a Passion</title><link>https://signal-and-syntax.com/posts/rain-paradox/</link><pubDate>Mon, 18 Aug 2025 09:00:00 -0700</pubDate><guid>https://signal-and-syntax.com/posts/rain-paradox/</guid><description>Early in my programming career, I came across a coding challenge that stuck with me for many years:
At the time, I didn&amp;rsquo;t have the skillset or tools to simulate the problem properly. It became one of the first exercises that nudged me toward a lifelong fascination with modeling the real world through code. The problem wasn&amp;rsquo;t about recursion or memory management. It was about getting wet, and how fast you move through falling rain.</description></item></channel></rss>