system
Given the following post, respond as if you're commenting on Reddit:
human
What makes a programming language "good" for certain tasks?

For example, I've heard that Python is a "good" language for data analysis, and C# is for building apps. Theoretically, all programming languages should be able to do the same things, so what makes one better for a certain task? Is it the standard libraries?
gpt
A range of factors, and a lot of opinion.

Some things are just hard requirements.  You need to use a language that compiles to native machine code if you want to write an OS kernel.  You can't really write a complete OS from scratch with no other code in Python or Javascript.  Interpreted languages like that need a bunch of extra code at run time to make them work.  But, you can't load that extra code without already having at least some minimal working OS of some sort.  So, you will see a lot of C in OSdev.  On the other hand, if you want to run code in a browser, you probably will use Javascript, because that's what browsers will run.

Sometimes it's just a totally arbitrary availability of tooling.  If some wacky professor writes a really great library for doing a particular task, then whatever language they write it in can suddenly become the best language for that task.  This kind of happened with Ruby when the Rails framework was released.  As a bare language, it's pretty similar to Python.  But for certain kinds of webdev, Ruby is much more convenient because people wrote better tools to do it in Ruby.

Performance can make a difference.  Pedants will point out that a programming language isn't inherently slow.  Different implementations of the same language can vary wildly.  Sometimes a slow language is fast, and sometimes a fast language is slow.  But in practice, Python is generally slow and C++ is fast.  So, you see C++ used in a lot of high performance stuff like 3D rendering and games.  (Or, at least game engines.)  Maya is written in C++, Direct3D games use C++, etc.  Lots of the modules that get used in a slow language like Python are written in C or C++, so you can o fast work with a slow language.

Static vs. dynamic typing, and a few other features effect the convenience of a language.  Python has nice simple Syntax, dynamic typing, and a bunch of useful libraries, so it tends to be an eminently convenient language.  Loading JSON into Python is very convenient because of the dynamic typing -- fields can be added to objects at run time when you load a JSON file.  Doing something similar in C++ is a pain in the neck, and has to be done with a bunch of indirection, specifying some classes ahead of time, and maybe some template weirdness, depending on exactly what you want to do.  So, loading some data and doing some processing (possibly using a fast module which is implemented in c++) tends to be super convenient in Python.

Static strong typing can be useful for for making big projects more reliable by writing pedantically type safe code.  It's a pain to write such code, and a pain to use.  But it eliminate a class of bugs that is really easy to write in Python.  And, a static type language can be analyzed for likely bugs ahead of time.  Python often explodes in completely unexpected ways at runtime, because of that dynamic typing you can never be 100% sure what somebody is going to pass into a certain function.  With C++, passing the wrong type of object to a function is generally just a compiler error, so you can't ship a program to a  user with that type of mistake in such a static types language.  Ada is no longer terribly common, but it used to be used in a lot of military and aerospace projects because it is even more enthusiastic about strong and static types than C++ is.


Does this help clarify?