r/ProgrammerHumor • • Oct 31 '26

Meme searchAndReplace

Post image
4.6k Upvotes

258 comments sorted by

View all comments

45

u/lysergicpride Oct 31 '26

I asked Claude to prettify a CSS file and it started writing a python script

20

u/Real-Self-3039 Oct 31 '26

Every time I see claude say "the pyhton script failed" while its working I'm like "python??? I asked you to write an md file of the changes you made wtf do you need python for?!"

23

u/Mu5_ Nov 01 '26

Because it tries to avoid ingesting and spitting out too many tokens, so it uses scripts to modify or read only what's needed. Remember that if Claude directly writes a 1MB text file, that's considered all output tokens. If it makes as script that injects text at the right place is much less

1

u/kernelboyd Nov 03 '26

I’m genuinely surprised the capitalists on this case didn’t make it that way. So much free money from people who don’t pay attention

1

u/Mu5_ Nov 03 '26

Because it's not a matter of cost saving but context size. If it doesn't fit inside the context then the model cannot process it at all. If in the future we will have huge context size (1B instead of 1M) then for sure we will have to pay attention

9

u/candybrie Oct 31 '26

It seems to want to edit documents with Python. It's also how it seems to want to check that it wrote a valid md file.

18

u/Tyrus1235 Oct 31 '26

I don’t know why, but Claude Code is in love with Python. It makes Python scripts for everything.

It’s a bit awkward

23

u/MattR0se Oct 31 '26

It automated the boring stuff lol

9

u/Real-Self-3039 Oct 31 '26

It automated the automation 🤣

4

u/Piranha771 Nov 02 '26

It's because a python script is determistic. Ask an AI to rename 400 occurrences in a repo using only inference will only work 99,9% of the time. Writing a python script that renames it and verifies it will work 100% of the time, with a lot less tokens wasted.

3

u/Old_Flounder_8640 Nov 01 '26

Even AI hates bash hahah

2

u/lysergicpride Nov 01 '26

I love bash, does this mean my existence is irreplaceable?

2

u/_ahrs Nov 01 '26

It is still better than when it tries to vomit out pages and pages of Bash scripts. At least I consider the Python it produces to be readable.

2

u/ReplacementLow6704 Nov 01 '26

For me it mostly creates js scripts. Distasteful to say the least

2

u/Flat-Performance-478 Nov 02 '26

Lowest Common Slopominator.

→ More replies (1)

17

u/StarHammer_01 Oct 31 '26

Cus for stuf like that you want something that is deterministic, python is deterministic, Claude is not

-8

u/lysergicpride Oct 31 '26

I can get a 4 billion parameter model to simply reformat a CSS file without it writing a script to do it dude its not rocket science lmao

8

u/StarHammer_01 Oct 31 '26

Claude isn't 4 billion, more like 4 trillion.

You can also get an monkey on a typewriter to reformat your files. But that doesn't mean its a smart move.

If you are fine with a nondertermistic token in => token out, fine. But this is just Claude being smarter than you.

0

u/lysergicpride Oct 31 '26

No what im saying is I've literally gotten a gemma 4B model to do this before SEVERAL TIMES with 0 issues, yes its smart to be one the safe side but there is practically no way a model as big as Claude would fuck that up

2

u/fahrvergnugget Oct 31 '26

Behind the scenes, Claude is constantly writing and executing code, even in response to normal language prompts that have any slightly analytical asks.

→ More replies (4)

5

u/tom_earhart Oct 31 '26 edited Nov 03 '26

Because it is the most efficient use of resources: a local script rather than more roundtrips. If you don't want it you can add a guardrail to not use local scripts.

4

u/vintergroena Oct 31 '26

Every. Time.

1

u/EatingSolidBricks Oct 31 '26

A real script file or it just raw dogged python into bash

1

u/kingvolcano_reborn Oct 31 '26

That is actually good, saves tokens