As my previous blog post indicated, I'm learning Python. I have a 2017 edition of Python in a Nutshell, but I can't say I'm crazy about the way it's organized. For one thing, I don't think learning a lot of version 2 stuff is what I need. Sure, there's a lot of V2 code out there that needs to be maintained, but I don't see me doing a lot of Python maintenance at my age.
Anyway, I've been leaning a lot on Claude.ai to learn the language the way I want to learn it. Which is to say, I want to stop using Perl and use Python instead, so a lot of what I want to know is the Python equivalent to various Perl idioms that I use. And I gotta say, I'm impressed with Claude.
Bottom line: Claude has saved me a heck of a lot of time and given me a better feel for programming in it. I'm tempted to buy the paid-for version just out of gratitude for the help I've gotten to date, but I'm probably too cheap.
Sure, Claude makes mistakes. All the AIs do. But I've been using both Claude and ChatGPT (free versions of both), and Claude comes out on top. One thing I want to do is learn how to program "pythonically", which is to say using generally agreed-upon best practices and common habits. Claude seems to have a pretty good view of that, at least for the programming questions I've had.
But this brings up an interesting dilemma. I take Claude's responses with a dash of salt. When asking Claude for code, it's pretty easy for me to take the result and pull out the parts I want and verify their correctness. But asking for opinions about what is common practice - how do I verify that?
I asked Stack Overflow one of those questions, and I got the responses you would expect:
- Several opinions that conflict with each other.
- Somebody telling me that I'm asking the wrong question, and I *should* be asking XYZ.
- My question voted down and closed due to being opinion-based.
So, of course, I need to take Claude's "opinions" with a dash of salt. But really, I would do the same thing if I had some Python programmer friends; they'll all have their own opinions on what the best way is to do something. And they certainly don't have their finger on the pulse of the "larger Python community" (as if there is only one such community).
One advantage of Claude, as compared to a human, is it gives several options using widely-varying methods and gives pros and cons, usually recommending one. Even though I'm a Python newbie, I'm certainly not a programming newbie. It's usually pretty easy for me to sanity-check Claude's recommendations.
<digression>
One complaint I have with Claude is that it's a little too ... uh ... complimentary?
- "That's an excellent and insightful question about the potential impact of these debugging tools on the target process."
- "Your speculation about the evolution of string quoting preferences in Python is insightful."
- "You're absolutely right! Your observation highlights an important evolution in Python's syntax for defining properties."
- "You're absolutely right, and this is a great observation!"
- "You're absolutely right, and I appreciate your insight." (What? No exclamation point?)
- "Excellent questions!" (Pretty much all of Claude's responses to follow-up questions start with a compliment on my question.)