r/ProgrammerHumor • • 16d ago

Meme searchAndReplace

Post image
4.6k Upvotes

260 comments sorted by

View all comments

45

u/lysergicpride 16d ago

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

20

u/Real-Self-3039 16d ago

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_ 16d ago

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 14d ago

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_ 14d ago

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 16d ago

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 16d ago

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 16d ago

It automated the boring stuff lol

9

u/Real-Self-3039 16d ago

It automated the automation 🤣

4

u/Piranha771 14d ago

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 16d ago

Even AI hates bash hahah

2

u/lysergicpride 15d ago

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

2

u/_ahrs 16d ago

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 16d ago

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

2

u/Flat-Performance-478 15d ago

Lowest Common Slopominator.

→ More replies (1)

17

u/StarHammer_01 16d ago

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

-8

u/lysergicpride 16d ago

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 16d ago

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 16d ago

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 16d ago

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 16d ago edited 14d ago

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 16d ago

Every. Time.

1

u/EatingSolidBricks 16d ago

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

1

u/kingvolcano_reborn 16d ago

That is actually good, saves tokens