Re:Ask HN: Codebases with great, easy to read code?
by simonw on Monday March 21, 2022 @09:58AM
(#30754181)
One recent example: I wanted to know if the SQLite package in Python took any steps to avoid calling "interrupt" on a closed connection, which the SQLite C documentation warns against.
A couple of searches against https://github.com/python/cpython lead me to this code here: https://github.com/python/cpython/blob/4674fd4e938eb4a29ccd5...
Re:Ask HN: Codebases with great, easy to read code?
by gerhardhaering on Monday March 21, 2022 @10:44AM
(#30754704)
It's nice that code that I wrote more than a decade ago is mentioned here.
Re:Ask HN: Codebases with great, easy to read code?
by simonw on Monday March 21, 2022 @12:21PM
(#30755940)
Thank you very much for building this, I benefit from it every day!
Since you're here... there was actually a question raised on the SQLite forum about that code and whether it is genuinely safe against a specific race condition... and I don't have nearly enough Python C knowledge to know the answer!
Does this look like it could be a problem to you? https://sqlite.org/forum/forumpost/f37ae374cc
Often this will be along the lines of "How does it do X?" - where X is something I either didn't know was possible or that I suspect to be really difficult.
Then I can dive in to the codebase (usually starting with GitHub code search) and try to figure out how they do it.
This helps me skip straight past the boilerplate and means I often get to a satisfying conclusion - where I've learned something new - in a very small amount of time.
And along the way I pick up knowledge about how their code is organized and often a few other tricks too.