<?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 Wilhelm Maritz</title><link>https://wjmaritz.dev/categories/python/</link><description>Recent content in Python on Wilhelm Maritz</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Sun, 24 Aug 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://wjmaritz.dev/categories/python/index.xml" rel="self" type="application/rss+xml"/><item><title>Use secrets, not random, and remember the shuffle</title><link>https://wjmaritz.dev/posts/secrets-not-random/</link><pubDate>Sun, 24 Aug 2025 00:00:00 +0000</pubDate><guid>https://wjmaritz.dev/posts/secrets-not-random/</guid><description>&lt;p>Python gives you two ways to pick something at random, and only one of them belongs anywhere near a password.&lt;/p>
&lt;p>&lt;code>random&lt;/code> is a Mersenne Twister. It is fast, it is reproducible, and that second property is exactly the problem: it is a deterministic algorithm driven by internal state. Observe enough of its output and you can recover that state and predict everything it will produce next. For a dice roll or a shuffled playlist, wonderful. For anything that guards access, disqualifying.&lt;/p></description></item><item><title>Parsing Markdown by alternating on odd and even</title><link>https://wjmaritz.dev/posts/markdown-parser-odd-even/</link><pubDate>Wed, 05 Mar 2025 00:00:00 +0000</pubDate><guid>https://wjmaritz.dev/posts/markdown-parser-odd-even/</guid><description>&lt;p>I worked through &lt;a href="https://www.boot.dev/courses/build-static-site-generator-python" target="_blank" rel="noopener">boot.dev&amp;rsquo;s Build a Static Site Generator&lt;/a>, a guided project that has you write the thing that turns &lt;code>**bold**&lt;/code> into &lt;code>&amp;lt;b&amp;gt;bold&amp;lt;/b&amp;gt;&lt;/code>. The architecture is the course&amp;rsquo;s: a &lt;code>TextNode&lt;/code> type for chunks of formatted text, an &lt;code>HTMLNode&lt;/code> tree to render, and separate passes for block-level and inline parsing.&lt;/p>
&lt;p>This is a write-up of the piece I found most elegant, not something I invented. The inline parser is a genuinely neat idea, and it took me a while to see &lt;em>why&lt;/em> it works, so it seemed worth explaining properly.&lt;/p></description></item><item><title>The particle fade that never faded</title><link>https://wjmaritz.dev/posts/pygame-alpha-never-faded/</link><pubDate>Sun, 26 Jan 2025 00:00:00 +0000</pubDate><guid>https://wjmaritz.dev/posts/pygame-alpha-never-faded/</guid><description>&lt;p>&lt;a href="https://www.boot.dev/courses/build-asteroids-python" target="_blank" rel="noopener">Asteroids on boot.dev&lt;/a> is a guided build. Its chapters cover Pygame setup, the game loop, the player, and the asteroids: enough for a working game. Everything past that is left to you, and that is where I kept going, adding momentum, a start menu, lives, scoring, and explosions.&lt;/p>
&lt;p>The explosions were the fun part. Shoot an asteroid and fifteen white particles fly outward and fade to nothing over half a second.&lt;/p></description></item><item><title>Space has no drag, so I added some</title><link>https://wjmaritz.dev/posts/space-has-no-drag/</link><pubDate>Sun, 19 Jan 2025 00:00:00 +0000</pubDate><guid>https://wjmaritz.dev/posts/space-has-no-drag/</guid><description>&lt;p>The &lt;a href="https://www.boot.dev/courses/build-asteroids-python" target="_blank" rel="noopener">boot.dev Asteroids course&lt;/a> gives you a ship that moves while you hold a key and stops when you let go. It works, it is simple, and it feels nothing like being in space. What I wanted was continuous motion: you thrust, and then you &lt;em>keep going&lt;/em>, because nothing out there is slowing you down.&lt;/p>
&lt;p>That is a small change to describe and a surprisingly interesting one to build, because the honest version of it is unplayable.&lt;/p></description></item></channel></rss>