2 ms·
Something I find really helpful is to start with a question that I want to answer. Often this will be along the lines of "How does it do X?" - where X is somet
by simonw 5y ago
Something I find really helpful is to start with a question that I want to answer.
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.
- simonw 5y agoOne 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 https://github.com/python/cpython lead me to this code here: https://github.com/python/cpython/blob/4674fd4e938eb4a29ccd5b12c15455bd2a41c335/Modules/_sqlite/connection.c https://github.com/python/cpython/blob/4674fd4e938eb4a29ccd5...
- gerhardhaering 5y agoIt's nice that code that I wrote more than a decade ago is mentioned here.
- edelans 5y agoAnd it's even nicer that you get the chance to see it !
- simonw 5y agoThank 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 https://sqlite.org/forum/forumpost/f37ae374cc