Top all-time · #3565
death and gravity
Personal blog · death.andgravity.comprogrammingweb
death and gravity is a personal blog at death.andgravity.com about programming and web. Since 2021, 20 different Hacker News readers have linked it 53 times, most often “Learn by reading code: Python standard library design decisions explained”. It is still writing: the last post was on 2026-06-24, and you can follow it by feed.
Too few sampled comments (6) to say how often HN recommends it.?
Why HN links it
HN readers link death and gravity for its Python newcomer post, praised for empathy and actionable advice, and for technical posts on run.sh scripts as a Makefile alternative and searching a 37 GB file.
Summarised by Claude from a sample of 6 HN comments that link here. Each comment is marked recommending, critical or neutral (citing without judging); how this works.
Most-linked posts?
- Learn by reading code: Python standard library design decisions explained4 people · 5 mentions · first linked 2021-04-14
- /pwned3 people · 3 mentions · first linked 2022-12-16
- Limiting concurrency in Python asyncio: the story of async IMAP_unordered()3 people · 3 mentions · first linked 2023-03-28
- Caching a Lot of Methods in Python2 people · 3 mentions · first linked 2023-02-14
- Python sentinel objects, type hints, and PEP 6612 people · 2 mentions · first linked 2021-06-14
- When to use classes? When your functions take the same arguments2 people · 2 mentions · first linked 2023-06-16
- How I almost failed to search a 37 GB text file in under 1 millisecond2 people · 2 mentions · first linked 2022-12-13
- ProcessThreadPoolExecutor: when I/O becomes CPU-bound2 people · 2 mentions · first linked 2025-04-22
- Inheritance over Composition, Sometimes2 people · 2 mentions · first linked 2025-07-22
What Hacker News says?
I do like "just" being suggested, but I strongly prefer using a very simple bash run script for tasks that do not require "make"'s extras, especially given that most modern build tools do parallelism and artifact caching internally. Inspired by: https://github.com/adriancooney/Taskfile https://death.andgravity.com/run-sh
Comment linking /run-sh
on “I Like Makefiles”Submitted The unreasonable effectiveness of f-strings and re.verbose as a story · 304 points
HN discussionI've really enjoyed: https://death.andgravity.com/
Comment linking /
on “Ask HN: Great Blogs by Programmers”Submitted Learn by reading code: Python standard library design decisions explained as a story · 282 points
HN discussionI cover The Architecture of Open Source Applications as well, here: https://death.andgravity.com/aosa :D
Comment linking /aosa
on “Learn by reading code: Python standard library design decisions explained”Submitted Write an SQL query builder in 150 lines of Python as a story · 141 points
HN discussionFor one, it can output more than one flavor of SQL: https://pypika.readthedocs.io/en/latest/3_advanced.html#hand... Since SQL is ever-so-slightly different across databases, I imagine trying to cover all of them as a single dev is a nightmare (especially if that's not the problem you're trying to solve). I wrote my own query builder because I know for sure I'm only targeting SQLite. The second I need my feed reader…
Comment linking /own-query-builder
on “Write an SQL query builder in 150 lines of Python”Submitted Namedtuple in a Post-Dataclasses World as a story · 113 points
HN discussionYup, after my own initial research I found it as well, and I like it a lot. I talk more about it here: https://death.andgravity.com/own-query-builder#sqlbuilder-py...
Comment linking /own-query-builder
on “Write an SQL query builder in 150 lines of Python”Submitted How I almost failed to search a 37 GB text file in under 1 millisecond as a story · 33 points
HN discussionHey, this has roughly the same philosophy as mine, I might add it to my survey: https://death.andgravity.com/own-query-builder#sqlbuilder-mi...
Comment linking /own-query-builder
on “Write an SQL query builder in 150 lines of Python”Submitted Dealing with YAML with arbitrary tags in Python as a story · 12 points
HN discussionThat's what the fancier __init__() at the end of the article[1] is for :) Here's the tl;dr of a real-world example[2]: query = Query().SELECT(...).WHERE(...) for subtags in tags: tag_query = BaseQuery({'(': [], ')': ['']}, {'(': 'OR'}) tag_add = partial(tag_query.add, '(') for subtag in subtags: tag_add(subtag) query.WHERE(str(tag_query)) It can be shortened by making a special subclass, but I only needed this once…
Comment linking /query-builder-how
on “Write an SQL query builder in 150 lines of Python”Submitted Learn by reading code: Python standard library design decisions explained as a story · 5 points
HN discussionIt's not either-or; I'm using the query builder to build _parametrized_ queries. Here are two examples: https://death.andgravity.com/query-builder-why#introspection https://github.com/lemon24/reader/blob/10ccabb9186f531da04db...
Comment linking /query-builder-why
on “Write an SQL query builder in 150 lines of Python”Submitted ProcessThreadPoolExecutor: when I/O becomes CPU-bound as a story · 4 points
HN discussionI cover this solution here: https://death.andgravity.com/own-query-builder#jinjasql-sqlp...
Comment linking /own-query-builder
on “Write an SQL query builder in 150 lines of Python”Submitted Python sentinel objects, type hints, and PEP 661 as a story · 4 points
HN discussionI wrote an entire article about why I didn't do that: https://death.andgravity.com/own-query-builder#sqlalchemy-co... In general, SQLAlchemy is an excellent choice; in my specific case (single dev with limited time), the overhead would be too much (even with my previous experience with it).
Comment linking /own-query-builder
on “Write an SQL query builder in 150 lines of Python”Submitted Inheritance over Composition, Sometimes as a story · 3 points
HN discussionSometimes you need dynamic SQL, because the DB doesn't have stored procedures you can use for the same purpose (e.g. SQLite). I talk more about this use case here: https://death.andgravity.com/query-builder-why#the-problem
Comment linking /query-builder-why
on “Write an SQL query builder in 150 lines of Python”Submitted Process Thread Pool Executor: when I / O becomes CPU-bound – death and gravity as a story · 3 points
HN discussion> In that sense, if anything this is a downgrade from regular SQL. It likely is. Ideally, instead of dynamically building queries, one would use stored procedures. I'm using this with SQLite, which doesn't have stored procedures, so it's an acceptable downgrade for me. Appending strings to lists gets messy quickly, example: https://death.andgravity.com/query-builder-why#preventing-co...
Comment linking /query-builder-why
on “Write an SQL query builder in 150 lines of Python”Submitted Learn by reading code: Python standard library design decisions explained (2021) as a story · 3 points
HN discussionGlad to hear that :D One of my main goals was to show the entire progression of how I approached the problem, instead of just saying "here's the final result". I have another article that covers profiling in more detail, you might find it useful: https://death.andgravity.com/fast-conway-cubes#intro-to-prof... Note that besides the cProfile text output, there are better, graphical tools for profiling; I've personally…
Comment linking /fast-conway-cubes
on “How I almost failed to search a 37 GB text file in under 1 millisecond”Submitted Reader 3.0 released – a Python feed reader library as a story · 3 points
HN discussionThey did mention they tried that, and got similar results to the binary search they were already doing: https://death.andgravity.com/pwned#position-heuristic
Comment linking /pwned
on “How I almost failed to search a 37 GB text file in under 1 millisecond”Submitted Learn by reading code: Python standard library design decisions explained as a story · 3 points
HN discussionIndeed that's discussed in the article, under "Position heuristic" - https://death.andgravity.com/pwned#position-heuristic
Comment linking /pwned
on “How I almost failed to search a 37 GB text file in under 1 millisecond”Submitted Asyncio-thread-runner: you can have a little async (as a treat) as a story · 2 points
HN discussion