| ▲ | llmslave2 4 days ago | ||||||||||||||||||||||||||||||||||||||||||||||
How are you using AI to learn? I see a lot of people say this but simply reading AI generated overviews or asking it questions isn't really learning. | |||||||||||||||||||||||||||||||||||||||||||||||
| ▲ | simonw 4 days ago | parent [-] | ||||||||||||||||||||||||||||||||||||||||||||||
I'm using it to build things. Here's an example from the other day. I've always been curious about writing custom Python C extensions but I've never been brave enough to really try and do it. I decided it would be interesting to dig into that by having Codex build a C extension for Python that exposed simple SQLite queries with a timeout. It wrote me this: https://github.com/simonw/research/blob/main/sqlite-time-lim... - here's the shared transcript: https://chatgpt.com/s/cd_6958a2f131a081918ed810832f7437a2 I read the code it produced and ran it on my computer to see it work. What did I learn? - Codex can write, compile and test C extensions for Python now - The sqlite3_progress_handler mechanism I've been hooking into for SQLite time limits in my Python code works in C too, and appears to be the recommended way to solve this - How to use PyTuple_New(size) in C and then populate that tuple - What the SQLite C API for running a query and then iterating though the results looks like, including the various SQLITE_INTEGER style constants for column types - The "goto cleanup;" pattern for cleaning up on errors, including releasing resources and calling DECREF for the Python reference counter - That a simple Python extension can be done with ~150 lines of readable and surprisingly non-threatening C - How to use a setup.py and pyproject.toml function together to configure a Python package that compiles an extension Would I have learned more if I had spent realistically a couple of days figuring out enough C and CPython and SQLite and setup.py trivia to do this without LLM help? Yes. But I don't have two days to spend on this flight of curiosity, so actually I would have learned nothing. The LLM project took me ~1 minutes to prompt and then 15 minutes to consume the lessons at the end. And I can do dozens of this kind of thing a day, in between my other work! | |||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||