I mean, Python modules can do all sorts of wild stuff when they're imported. See import antigravity for example. Checking if you can actually import it properly isn't that unreasonable.
What??? No. I've believed in the existence of the number 45 my whole life. What whole integer comes between 44 and 46 now? First Santa Claus, the Easter Bunny, the Tooth Fairy, and now the number 45...
AI Coding tools do some dumb shit, but this one I honestly don't mind so much. Given the nature of LLMs, they will never be 100% reliable to read and validate syntax, so either the developers make or use a linter (which would be viable, but also will be harder to adapt to specific versions etc.), or they just import it and see if its able to at least be imported.
This isn't a bad way to check this. And it's a much easier thing to fix if something breaks.
With this snippet you need to check that the user is using bash (or anything similar) and assume the answer. With a print the llm can write what it expects while being platform independent
Also due to && short circuiting, you only output a status code of 0 if successful, might as well just print / echo at that point as it doesn't communicate any non-zero exit code on failure 😒
If that module didn't exist, the import would error and it wouldn't get to the print. It works, but, like I said, testing the exit code would be better.
It's testing that the import system can find the module as expected from where you wanna import it. If you've developed in python for a while you know what a pain in the ass it can be, so this is like a non-REPL way of doing the same kind of sanity check that many of us have learned to do over the years...
Yep, $100 a month to make sure that modules import without errors. Definitely not for anything else like the six phases of the project that the AI presumably already did.
Or just don't use Python and use Perl or Java 😂, but that still would still do similar @INC or package checks for Perl. This is why Generative AI > Agentic AI. Not faster, but better for mostly knowing what your code does at 1/5th the price.
233
u/TehNolz May 06 '26
I mean, Python modules can do all sorts of wild stuff when they're imported. See
import antigravityfor example. Checking if you can actually import it properly isn't that unreasonable.165
u/robhaswell May 06 '26
I see nothing wrong with this.
77
u/FlagerantFragerant May 06 '26
We should start charging more for AI to discourage such posts
64
u/LeeHide May 06 '26
What's the issue?
28
u/RegisteredJustToSay May 06 '26
It's testing that the import system can find the module as expected from where you wanna import it. If you've developed in python for a while you know what a pain in the ass it can be, so this is like a non-REPL way of doing the same kind of sanity check that many of us have learned to do over the years...
9
u/JAXxXTheRipper May 06 '26
Me getting a claude code ad on mobile reddit is just the cherry on top.
But on topic, this is a sanity check, you should always do it. So there you go. Yet another post that should not be here.
17
u/csch2 May 06 '26
Yep, $100 a month to make sure that modules import without errors. Definitely not for anything else like the six phases of the project that the AI presumably already did.
2
u/BeardedDuck9694 May 10 '26
I know im tired when I thought it was just printing that it was fine without actually checking anything.
2
u/jolharg May 06 '26
for eating a python? automatically? no thanks i can do that myself. if i wanted to. which i don't.
1
u/Ok-Count-3366 May 08 '26
Ahahahahaa
1
u/jn-cuber May 10 '26
from this post you can tell OP's prompts look like "can you make this, no bugs please"
1
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” May 06 '26
I always wondered who the hell is paying that much for AI except for businesses paying for it for their employees.
1
u/SimplexFatberg May 09 '26
It is pronounced "one hundred dollars", it is spelled "$100".
1
u/cenpact May 09 '26
You’re actually a shit dev if you don’t do this
0
u/Phantom914 May 09 '26
Or just don't use Python and use Perl or Java 😂, but that still would still do similar @INC or package checks for Perl. This is why Generative AI > Agentic AI. Not faster, but better for mostly knowing what your code does at 1/5th the price.
0
u/namelesssdeveloper May 10 '26
I mean it works because if it wouldn't be imported then it would give an error and wouldn't print
-1
u/[deleted] May 06 '26
[removed] — view removed comment