When I was in ~9th grade ordering 72-pin SIMMs, I read MUST BE INSTALLED IN PAIRS and assumed that vendor only shipped to France.

AbsolutelyNotCats
link
fedilink
English
-10
edit-2
1Y

deleted by creator

Data Scientists and AI engineers. Python has really good libraries for machine learning and other numerically intensive applications. Try launch deep learning models on your GPU with only shell scripting.

Probably the biggest takeaway I had from the appdev courses I took last year.

I think you’re near enough alone… Python is up there with the best ways to call other people’s code, due to the support for types beyond string…

AbsolutelyNotCats
link
fedilink
English
-61Y

deleted by creator

Dandroid
link
fedilink
61Y

So you’re wasting hours of development time to save a couple of milliseconds of run time.

If that’s your only criteria for choosing a language, you’re gonna have a bad time.

AbsolutelyNotCats
link
fedilink
English
-51Y

deleted by creator

To be fair, sometimes that runtime difference matters. That’s why it’s C++ and python is a fairly common skill-combo amongst devs. But the fact that this dude is basically bragging about writing shell scripts as if that’s something an experienced dev couldn’t figure out tells me that they don’t really know anything about when you would choose either.

If they had mentioned the Global Interpreter Lock or dynamic typing maybe they would have had some sort of real case for why you should avoid python in certain situations.

AbsolutelyNotCats
link
fedilink
English
-21Y

deleted by creator

Slower than bash? Especially in bash script where it calls other utils?

“New processes have no overhead!” - this idiot probably

Tbh I think we should just ignore them. They clearly have no interest in actually learning anything.

Maybe you should check how python compares relative to shell scripts before you comment. You’re making it very apparent that you don’t actually know what you’re talking about. Regardless of how slow python is, it is significantly faster than bash, or any other shell language purely by virtue of the fact that shell languages are primarily glue between other programs. Spawning a new process has a ton of overhead, which you would know if you were capable of doing anything other than projecting.

You’re also woefully unaware that it is completely possible to write python bindings for C++ code, which many popular libraries do. In practice python is not as slow as you think it is. That’s not even considering the fact that python 3.12 increased performance of the language.

It’s not perfect for everything, but this performance argument shows that you don’t know enough to understand why that isn’t really a drawback for writing scripts, which is undeniably an area that python excels at.

Dandroid
link
fedilink
21Y

Totally agreed the run time difference matters sometimes. In my experience it’s hasn’t been the case for scripts, as they are generally small in scope in comparison to C++ applications.

Agree 100%. At work I write my code that needs to be performant in C++ and scripts in python. I wouldn’t even dream of writing a script in C++.

Dandroid
link
fedilink
121Y

Do you do any scripts beyond extremely simple ones?

I do a fuck ton of scripting in both bash and python. I never want to do string manipulation in bash. As soon as string manipulation is required, I automatically choose python for a script. Also, if I need named arguments or multiple levels of arguments for subcommands. You can use sys.argv for basic args, which isn’t any harder than bash arguments, but for complex inputs, argparse is a godsend. It has a bit of a learning curve, but it can handle anything. Bash requires you to write complex arg handling manually with loops and reducing.

I’m trying to bash it but the problem persists. Please help.

AbsolutelyNotCats
link
fedilink
English
-31Y

deleted by creator

Tbh you’d still be better off writing them in python. They’ll be more maintainable, and you’ll learn valuable skills.

Also, since you commented that python was the slowest language ever, shell scripts are often significantly slower. This is due to the fact that shell commands are actually calling other programs, which is very very slow.

You should check out Click. Way more user friendly than argparse imo. I agree with all of your points though, and I’d also add if you are working on a team that it will be infinitely easier for a co-worker to decipher your python code compared to a bash script. And you can write unit tests with py test, the list goes on and on. If the environment you are deploying to has the python interpreter, you should use python over bash.

Dandroid
link
fedilink
31Y

I’ll take a look at Click. Something better than argparse definitely piques my interest, because while the features are great, it feels a little cumbersome at times.

Java required!? Damn it, I don’t even drink coffee!

doomkernel
link
fedilink
6
edit-2
1Y

But then it said “Cobra required to run script”

BetterNotBigger
link
fedilink
English
711Y

Dad programming jokes are the finest there is.

@saigot@lemmy.ca
link
fedilink
39
edit-2
1Y

As a blind wheelchair user I find all the “see sharp run-time required” messages to be highly discriminatory!

Damn, I should have known. But this one got me.

Owl
link
fedilink
51Y

Minecraft: requires Java

The dutch wanting to play minecraft:

1000008402

@nonearther@lemmy.ml
link
fedilink
English
371Y

It doesn’t need to be a pet. You can use wild python as well.

Or Monty Python if you’re a cultural person

Sahwa
link
fedilink
521Y

Just wait until the python scripts require you to pet anaconda

Which will, in turn, require that your project has buns, hun.

Andrew
link
fedilink
31Y

micromamba is 100% better.

Create a post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
  • 1 user online
  • 61 users / day
  • 247 users / week
  • 417 users / month
  • 2.88K users / 6 months
  • 1 subscriber
  • 1.53K Posts
  • 33.9K Comments
  • Modlog