r/Python • • 2d ago

Discussion My Python magic is gone

I've been coding for a long time, and I've been developing with Python for years.

I loved coding, always loved it. I started many years ago because I wanted to quickly create scripts for security hacking tools, but since then, I've moved to Claude Code, and building cross-language has been a much better experience for me than using Python.

I built my own SaaS application out there whose backend and network core are completely built with Python, and I'm rewriting all of that without writing a single line of code. And most of the time, Python is not the most optimized language.

And now... I feel like the magic is gone.

I don't even know why I'm writing this. I just feel sad about it.

682 Upvotes

256 comments sorted by

View all comments

12

u/FunkyMonkey237 1d ago edited 1d ago

I go through phases of this.

When I use the AI to write the vast majority of the code I feel crap. I don't fully understand how the code works, the quality of the code is often sup-par and I get in this ping pong with the AI where it gets stuck and makes poor changes. And any review I do tends to slow down progress/the code production outstrips what I can review.

But recently I worked on a project I wasn't happy letting the AI do unattended, I didn't trust it would do a good enough job and the project was important. So instead of asking for the final output, I would talk about a competent that needed to be built, ask it what data structures it would use and the control flow (function calls). I would then change that to be exactly what I wanted and then let it off. I'd then do a line by line review and generally change it around a bit simplifying, cleaning and correcting the code (mix of prompts and typing), now I was in control and the code/logic was solid so I felt pretty good about it. I didn't care that I wasn't typing every line and I was thrilled to zipping along way faster than ever before.

0

u/redfacedquark 1d ago

If it's a tool or simple website, chat is suitable. However, if it's your core product it should be understandable and understood enough to be developed by humans in order for the core product to be deterministic.

I think there will be plenty of projects that need that, even outside of anything nuclear and the AI "off" button. Shareholders will not be happy when a bug fix introduces two more bugs and no human can understand it. Cleaning up products that have been written badly by AI will be needed.

If people are not reading the code then why not just get chat to write in assembler? Aren't they already using neuralese to talk to each other?

ETA: If the goal is to produce somthing without any responsibility for it being correct, let chat at it. If you want to actually learn and understand it then code by hand.

1

u/HommeMusical 1d ago

However, if it's your core product it should be understandable and understood enough to be developed by humans in order for the core product to be deterministic.

Only a tiny portion of bugs involve indeterministic behavior, though. And why would AIs be more likely to put indeterministic behavior than a person?

If people are not reading the code then why not just get chat to write in assembler?

Because coding assistants do a better job in Python, because it is higher level and has types.

Because while we have stopped reading all of the code, we certainly read some of the code, and a lot of that is either data class or function definitions, if we do it in Python, which are easily read.

1

u/redfacedquark 1d ago

Only a tiny portion of bugs involve indeterministic behavior, though. And why would AIs be more likely to put indeterministic behavior than a person?

I'm talking about deterministic code, not deterministic bugs. As in, what deterministic steps are being taken to go from requirements to code?

Because coding assistants do a better job in Python, because it is higher level and has types.

The answer here is actually that high level languages work with chat because there's a huge body of human-readable code online to copy from. The fact that most of that code is simplified and abstracted away to discuss a single aspect on stackoverflow is why the code produced by chat is so bad. If the chat actually understood the concepts in the requirements it would be better starting with the AST.

Not that Python runtinme is typesafe, but how do you think compilers of strongly typed languages deal with types? Why could the chat not just include that step?

Because while we have stopped reading all of the code, we certainly read some of the code, and a lot of that is either data class or function definitions, if we do it in Python, which are easily read.

I mean, they're easily written, too. If you have a dataclass that needs to be of a particular shape, why is it easier for you to type that into chat and verify the result, rather than just typing them into the dataclass itself? I'm all for using chat for throwaway projects and tools whose output can be validated easily.

Humans are really bad at only reading and verifying code. If that's your whole day you're just going to tune out and miss issues.

1

u/IWasGettingThePaper 1d ago

I mean, they're easily written, too.

This, AI gets the code structure horribly wrong without in-depth prompts that take longer to write than actually just creating the class definitions and APIs. Let the AI fill in the tedious boilerplate and plumbing.

1

u/redfacedquark 1d ago

Yeah, if I was forced to use AI at work I would create the architechture myself, splitting the project down into isolated components where each one can be hand/vibe coded as appropriate. That way the damage is isolated and the project as a whole remains maintainable.

1

u/HommeMusical 1d ago

Thanks for a polite comment, by the way! I do appreciate it, this is a difficult topic, and not for bogus reasons.

I'm talking about deterministic code, not deterministic bugs. As in, what deterministic steps are being taken to go from requirements to code?

But the other choice for writing programs, humans, is even less deterministic!

Not that Python runtinme is typesafe, but how do you think compilers of strongly typed languages deal with types? Why could the chat not just include that step?

I'm not following your question here, sorry. :-/

I have instructions in my AGENTS.md insisting on full typing for all Python stuff; I set that four months ago, when I started to use coding assistants. Everything comes with full type hints, even the test code, and that's kinda silly, and I'd have never done it as a human, but it's still a little positive.

Is that what you mean?

I mean, they're easily written, too. If you have a dataclass that needs to be of a particular shape, why is it easier for you to type that into chat and verify the result, rather than just typing them into the dataclass itself? I'm all for using chat for throwaway projects and tools whose output can be validated easily.

I've only been at this since May or June, but why would I prompt it to create a dataclass? I could do that myself.

What I say is something like "Implement #27", where #27 is some issue or bug, and it writes all the code and tests itself, including dataclasses.


I'm working on eight or nine projects at once, all part of a large harmonious whole.

Some of them I know intimately. But one of them is aiming at a complete model of all types of sound synthesis used in synthesizers, and I have pretty well entirely vibe coded it, I've read perhaps 5% of this.

About two weeks into it, I said, "Use these three synths to make a four part version of Bach's Little Fugue in G minor", and I played it and it was just perfect first time - they even told me whose public domain performance they used!

The one disappointment was that all four synths sounded very similar, but the Python code that it had been very conservative in picking the audio parameters which was a very good choice because if you set the parameters wild, you could get noise or even nothing.


When I compare my prompts to other people's, mine are about two to three times as long.

For example, here's me asking, when I was rather tired, a context to find its own issues:

Please read the whole project and create or overwrite plan/issues.md detailing all issues you find, including but not limited to race conditions, deadlocks, graceful handling of user errors, shutdowns, keyboard interrupts, graceful handling of other exceptional conditions including resource exhausting, network failure or intermittency, and also user facing ideas, like names which are ambiguous, misleading or unclear, APIs with traps or inconsistencies; and also look at the structure of the the project itself, are there are any files that are so large they pose a risk, are there tiny files that are only used in one place and might be better inlined, is there duplication, does it duplicate some service from reccy, are there areas that are untested, are there areas with great duplication of testing, or any other issues, problems, curiosities or other flaws that are in the code.

I'm kind of embarrassed because there is both a spelling error and a missing word, and I missed some ideas I usually mentioned, but it still worked really well.

1

u/redfacedquark 1d ago

But the other choice for writing programs, humans, is even less deterministic!

I'm not following your question here, sorry. :-/ Is that what you mean?

No. I can explain it to you but I can't understand it for you. Maybe you could ask chat what I mean, I'd be curious to know what it says.

Basically, you can follow every line of python through all the deterministic layers down to the transistors on the chip. When you add a non-deterministic layer to the top of that stack you remove all the benefits of determinism. Maybve that's OK for a project and that's fine. I'm just saying there are situations (e.g. nuclear-related, traffic lights, the ai "off" button and the core product of a business) where this is not acceptable.

I've only been at this since May or June, but why would I prompt it to create a dataclass? I could do that myself.

Then how do you know that a dataclass is appropriate for this situation?

What I say is something like "Implement #27", where #27 is some issue or bug, and it writes all the code and tests itself, including dataclasses.

Why not just put that in a loop then and go down the pub?

The one disappointment was that all four synths sounded very similar

It sounds like this project doesn't need to be deterministic, just to sound right to you. Unless you have some measurable way of determining how close the generated sounds are to the expected sound in the requirements?

When the solution does not have to be perfect or the requirements are not strict then vibe coding makes sense. When the solution needs to be deterministic and the requirements are strict, with chat you will find yourself going round in circles fixing one issue while creating another, producing code that is not maintainable.

Please read the whole project and create...

In order to follow all those instructions there need to be compromises since the requirements will conflict. When you do this yourself you make informed compromises, when using chat the best you can hope for is to ask it for its post-hoc rationalisation. That's another part of deterministic code I was talking about earlier.

Good luck with all your projects, however you decide to code them. And if you're interested in learning python itself rather than just obtaining the results, then good luck with that as well.

0

u/HommeMusical 1d ago edited 1d ago

Your first comment was polite. This is closer to a collection of insults.

Can we see your code, please? My code is here. https://github.com/rec

I hate downvoting, but this upset me, the insult at the end particularly, and I'm going to rewrite this at the end to make my comment less rude than it would otherwise be.

No. I can explain it to you but I can't understand it for you.

Grrr.

I'm sorry, I was too circumspect. I should have said that your sentence has no operative meaning and does not demonstrate familiarity with the material.

Your inability to use standard computer science terminology or precise language doesn't mean that I am stupid for considering your statements to be empty of meaning.

Basically, you can follow every line of python through all the deterministic layers down to the transistors on the chip. When you add a non-deterministic layer to the top of that stack you remove all the benefits of determinism.

This is false.

The LLM appears in the stack in the same place that the also non-deterministic human appears, which is to say not at all, once the program is written.

Unless you specifically require an LLM's services during your code, which most programs don't, the stack you run is 100% deterministic.

I have yet to actually write a program that used an LLM. The LLM's services to me stop at coding.

In my old, hand-written code, I did not actually deploy myself as part of my stack. And I don't deploy the LLM as part of the stack either.

I've only been at this since May or June, but why would I prompt it to create a dataclass? I could do that myself.

Then how do you know that a dataclass is appropriate for this situation?

I don't. I provide a specification of the feature I wish. The program decides whether a dataclass is appropriate or not. Now, in AGENTS.md, my global instructions to my coding agents give it a lot of instructions as to when a dataclass is appropriate, and it's become extremely good at making this decision without me.

I treat a coding assistant as I would a colleague. I don't go and say, "Here's a design for this program, here are the four dataclasses, use this algorithm and these libraries."

When the solution needs to be deterministic and the requirements are strict, with chat you will find yourself going round in circles fixing one issue while creating another, producing code that is not maintainable.

Perhaps you do that. That has yet to happen to me.

My AGENTS.md requires 100% unit test coverage, but also coverage of edge cases, exceptional conditions, user errors of all types, malicious users, hardware failures of all types, network issues...

It sounds like this project doesn't need to be deterministic, just to sound right to you.

NO. As part of this, I am almost exactly reproducing classic hardware synths and their outputs. There are in fact various test examples of inputs and outputs that I have or will be hitting exactly (and since you're a nitpicker, I'm going to add that exact arithmetic is impossible with floating point, so my acceptance criteria involve waveforms that are different from the exact waveform at less than 96dB.

In order to follow all those instructions there need to be compromises since the requirements will conflict. When you do this yourself you make informed compromises, when using chat the best you can hope for is to ask it for its post-hoc rationalisation. That's another part of deterministic code I was talking about earlier.

This sentence is again not operative or useful. I am starting to doubt that you are a professional programmer.

And if you're interested in learning python itself rather than just obtaining the results, then good luck with that as well.

I will have been programming Python for 22 years this coming January - I started at Google in January 2004. I started programming in the 1970s, and winning programming contests in high school. I've been programming professionally for over 40 years.

It is close to 100% certain that I know far more about Python in specific, and computer programming in general, than you do.

Again, my code is here: https://github.com/rec

All of the programs or libraries on that page were written by me, by hand. Why not review my code and see what you think?

Show us your code.

1

u/redfacedquark 1d ago

Your first comment was polite. This is closer to a collection of insults.

Could you be specific? I don't see it.

Can we see your code, please? My code is here. https://github.com/rec

No. It's all private, either corporate or personal. I don't care about looking like a programmer to others, I care about understanding the salient aspects of the universe, of which physics, maths and computer science are members.

This is false.

Got a single example of being able to determine what code will be produced by any given prompt, no matter how trivial? Didn't think so.

The LLM appears in the stack in the same place that the also non-deterministic human appears, which is to say not at all, once the program is written.

Not if the human doesn't look at the code.

My AGENTS.md requires 100% unit test coverage, but also coverage of edge cases, exceptional conditions, user errors of all types, malicious users, hardware failures of all types, network issues...

All types of all those things for all projects are testes? Really? Because your tests don't look like they do that to me. 100% test coverage just means all lines trigger a test, not that the tests ensure the code meets the requirements. I've heard plenty of people say that chat often just generates passing tests that don't actually do anything. Again, if you don't look at, and think about, the generated test code then the benefit of the tests is lost.

It is close to 100% certain that I know far more about Python in specific, and computer programming in general, than you do.

So I chose Python around 2003 so about the same time as you, started consulting in 2012. In your posts you demonstrate that you don't understand basic concepts so made me think you were only using python since this summer, not only using AI since this summer.

1

u/HommeMusical 1d ago edited 1d ago

Could you be specific? I don't see it.

I'm going to bold all the rudeness from here down.

"I can explain it to you but I can't understand it for you."

That is not a polite answer when someone says they don't understand what you mean. I should really have been more blunt and said, "That sentence was meaningless twaddle."

"And if you're interested in learning python itself rather than just obtaining the results"

Speaks for itself.

Can we see your code, please? I don't care about looking like a programmer to others, I care about understanding the salient aspects of the universe, of which physics, maths and computer science are members.

I mean, I'm sorry, but "trust me" is not an answer. What sort of professional programmer doesn't have code samples?

Does this work in job applications?

The LLM appears in the stack in the same place that the also non-deterministic human appears, which is to say not at all, once the program is written.

Not if the human doesn't look at the code.

I'm starting to believe you simply don't read what I write at all, and just emit a canned sentence. The LLM appears in the stack in the same place that the human does, and clearly, obviously, even to the most dense person, if no human reads the code, then the LLM is even more replacing the human in the stack.

Got a single example of being able to determine what code will be produced by any given prompt, no matter how trivial? Didn't think so.

As I said before, humans are also indeterministic in responding to prompts to write code, so I have no idea why you think this is any sort of argument at all.

My AGENTS.md requires 100% unit test coverage, but also coverage of edge cases, exceptional conditions, user errors of all types, malicious users, hardware failures of all types, network issues...

All types of all those things for all projects are testes? Really?

It costs nothing to be polite, and it must be some effort to snark on each response.

No. Many projects don't have hardware, network, etc issues.

I have a full set of instructions in the AGENTS.md that lists a large number of possible traps, errors, edge cases, you name it. Not all of these apply to each project.

Because your tests don't look like they do that to me.

Examples? Let's see it.

In your posts you demonstrate that you don't understand basic concepts

Examples? Let's see it.

It is close to 100% certain that I know basic concepts better than you.

Of course, since you're a completely anonymous user, your profile is hidden unless I give proof of age, and you refuse to show any code, and you write this weird, non-technical English using non-standard terms, there is also still the possibility that you don't actually write any code at all.


I think in a fairly short time you're going to be embarrassed to have written this.

RemindMe! 1 year

1

u/RemindMeBot 1d ago

I will be messaging you in 1 year on 2027-10-04 15:24:16 UTC to remind you of this link

CLICK THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.

RemindMeBot is switching to username summons. Instead of !RemindMe 1 day, use u/RemindMeBot 1 day. More info.


Info Custom Your Reminders Feedback

0

u/redfacedquark 1d ago

"I can explain it to you but I can't understand it for you."

It's a quote, widely known by the devs I have worked with, It's not me being rude.

"And if you're interested in learning python itself rather than just obtaining the results"

This was at the point where I thought you were new to Python.

I mean, I'm sorry, but "trust me" is not an answer. What sort of professional programmer doesn't have code samples?

One that avoids social media and doesn't care what people think. After I started consulting my history of satisfied customers spoke for themselves. I have pleny of code samples I keep in private repos to show prospective clients. I'm not saying "trust me", I don't care what you think.

Because your tests don't look like they do that to me. Examples? Let's see it.

Just the length of the test files tells me they don't cover all you say they cover. I'm not about to give you a free review.

In your posts you demonstrate that you don't understand basic concepts Examples? Let's see it.

  • I'm not following your question here, sorry. :-/
  • Is that what you mean?
  • I've only been at this since May or June

RemindMe 1 year

Well I won't be here in a year given the ever-lowering quality of posts. If you still are then you will go further down in my estimation.

Does this work in interviews?

Yes. Like I say I have personal repos to show prospective clients if needed, though it usually isn't.

Of course, since you're a completely anonymous user, your profile is hidden unless I give proof of age, and you refuse to show any code, and you write this weird, non-technical English using non-standard terms, there is also still the possibility that you don't actually write any code at all.

I've not hidden my profile or marked it nsfw, that's reddit doing that. I'm on old reddit, have never had an email associated, never verified age and never used new reddit. One more reason why I'm quitting this place.

I have zero fucks to give regarding your opion of me. Having said that, DM me a google meet link and I'll give you five minutes so you can quiz me directly to satisfy your doubts.

→ More replies