3 ms·
Hey, OP here. Good question! Indeed, I tried initially to write this as a top-to-bottom thing that tangles in the "obvious" (sequential) way. This proved limi
by FrenchyJiby 4y ago
Hey, OP here.
Good question! Indeed, I tried initially to write this as a top-to-bottom thing that tangles in the "obvious" (sequential) way.
This proved limiting quickly because of my intention to run formatting/linting tools (secondary objective of "showcase modern Python" conflicted with the literate programming one). Successive code blocks for the same file were separated by a single line, but Python functions require 2 lines of separation to match PEP8 formatting.
Similarly, some of the TDD aspect of "define a stub function to get a red test" meant that to re-write the function later, I'd have to overwrite an "old" (in narrative timeline) codeblock, so I would need out-of-order tangling anyway.
I did consider if I really wanted to show the out-of-order tangling blocks, as it looked a little ... unclean? But eventually it felt like a good enough review/summary step of each feature, debriefing on the resulting code.
The real value of this out of order tangling was stuff like adding the @cache decorator way after initially definining the function itself, felt like a big win.
A few last-second edits (see the git history, it's fun...) of the code to fix bugs/warts made me re-visit some sections, and as I mention in sibling comment, I definitely had to reconciliate the tension "narrative-as-I-built-it" vs "proper-but-ex-post-facto".