a lot of problems can be solved well with python.
The frameworks are also priceless. What is an alternative to Django, for example?
Nearly every backend service I create is with python, unless it needs speed or rock-solid reliability. For that I use Go. Dynamic UI/UX I use nextjs with python backend.
I think the only irreplaceable part of the Python ecosystem at the moment is the math/stats/NN stuff. I wouldn't hire a data scientist who refused to learn Python, but I would hire a web dev who refused to learn it.
Presumably you're referring to ASP.NET, but if not, I'd love to know what you're working with. They're not really all that comparable. If I want to make something very quickly and need it to be trustworthy, I'll use Django, especially with the admin site. That said, these days I'd much rather work in the .NET ecosystem.
Sure, but .NET includes ASP.NET.
> If I want to make something very quickly
The difference in setup time between a modern .NET 7 web application and Django is basically nothing. You can have a boilerplate project in a few seconds, and the Hello World for the API side is 4 lines:
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();\
app.MapGet("/", () => "Hello World!");
app.Run();
> and need it to be trustworthyI don't understand what this means.
Security? .NET is very likely more secure out of the box because it's supported by a far larger company and is used by so many large organizations.
Lack of runtime errors? You're going to have more in Python because it doesn't have a compiler with strict rules.
I only use Python specifically for utility scripts for this reason.
Not having to type annotate every tiny thing is also great. You can type only what brings you value and leave the rest to be inferred. It really is the best of all worlds.
You set up an application once, write each line a few times, read it dozens of times, and run it millions of times.
The most costly part of that process is reading/rewriting because developer time is expensive.
Language choice should be optimized to make it easy to read other people's code and to prevent mistakes from getting into production. Python is not near the top of the pack in those dimensions.
I think most people would definitely disagree with you on the first point. As far as languages go, Python is probably one of the most readable ones out there. It's often even compared to pseudocode because well written Python reads like it.
The latter is a valid point, but assumes all code you ever write is made for production. That's just plainly false. Python is great for tooling, automation, prototyping and many other smaller scale non-production usage. That's where the low-barrier of entry really shines.
I could not disagree more. Python (as most people write it) has many things that make it less readable:
1. Semantic whitespace (absolute disaster for readability, almost as bad as YAML)
2. Choosing to "save keystrokes" by removing helpful visual cues that other languages have, like parentheses, semicolons, and brackets -- these things make scanning much easier
3. As most people write it, very few line spaces, making Python look like an unbroken run-on sentences instead of nice blocks of code
I've been writing and maintaining code for 26 years, and I've worked a lot with C#, JS/TS, Python, and PHP. I know other languages but haven't spent as much time with them.
Out of those, PHP is ironically the most readable because of its $ variables, and then the order is C#, TS, JS, and then Python. Python is hard to scan and just looks like a brick wall at first glance.
Compare
namespace HelloWorld
{
class Hello {
static void Main(string[] args)
{
System.Console.WriteLine("Hello World!");
}
}
}
to print("Hello World!")
and std::ifstream t("foobar.txt");
std::stringstream content;
content << t.rdbuf();
to with open('foobar.txt') as file_object:
content = file_object.read()
How can you honestly look at any of that and claim Python isn't far more readable. It literally reads like English. "With open foobar.txt as file object, content equal file object read". Compare that to whatever monstrosity the ifstream string stream << rdbuf crap is...I'm a Dart developer by day, Rust enthusiast by night, both are relatively modern languages and the tooling just feels right (of course nothing is perfect): the analyzer, linter, testing, dependency management, lsp, formatter are all just there.
I never want to go back to 20-30 year old languages where, for all these tools, there are 10 different subpar solutions with three decades of baggage, history, and context (though, of course, congrats on the 1000x speed up).
Python, JavaScript, Java, C++, are all in this category, and honestly, even community favorites like TypeScript and Kotlin have similar warts.
It doesn't happen in Python either. So that's good.
> barely ever needing to touch the terminal
Not really a good sign, point-click developers are not usually the strongest. That said I like things to work easily and don't have many quarrels with Python. Certainly fewer than most other languages.
Sounds like you're not very familiar with it and got used to C#. I don't have a problem with anything you list.
In principle I agree, but my point is - it was possible to be fully productive being just a point-click developer.
> It doesn't happen in Python either. So that's good.
pyright + black + isort hook in the project I'm working on takes 1-5 seconds on an M1 mac on save. We're moving to ruff for this reason. Never saw this anywhere else.
> I don't have a problem with anything you list.
To give better examples:
- poetry takes ~900 seconds to resolve dependencies during update/lock
- I had to use multiprocessing where in any other language I would use threads because GIL, inter-process communication is needlessly complex
- I can't dot+tab+enter autocomplete while using boto or many other libraries - due to weak typing discoverability suffers and I need to have documentation always open in another window to do anything. This is not a problem in strongly typed languages.
- wsgi - concept of running separate interpreters for each incoming request is a bit wasteful
- I never had any problem with broken / incompatibile environment like I had on python. I just install recent version of .net / rust / node (to a lesser extent) and things generally tend to work. Here I have to worry about specific subversions and conflicts in PATH with another envs and OS-packaged python. Avoidable, but noobs are certain to hit this at some point.
- I didn't talk about general speed as it's beating a dead horse, but Python basically nullifies the last 20 years of hardware improvements
> Sounds like you're not very familiar with it and got used to C#.
I also used Rust and Go and was super happy with the experience for similar reasons.
git status | grep \.py | tools
And it should exit in a split second. We have a pretty large codebase, though not gigantic.It probably will also support Ruff if it doesn't already.
Still, I want some things to run more often than commit, such as pyflakes.
1. Micro-optimisation,
2. Better algorithms,
3. Change the problem.
The potential impact of each of these increases as you go down.
Choosing Rust over Python is micro-optimisation. All things being equal, the impact isn't going to be that great. People are like "let me squeeze out every ounce of power from my CPU so I can run a linter on the entire codebase every time I save". Python folk are like "why on earth would you do that?" We simply changed the problem.
You are thinking like a software engineer, understandably
If you looks at STEM research fields Python is a solid tool for the fact it is a utlility/scripting tool. All the issues you listed rarely occur in this instance.
Most of the Python I write has a very limited lifetime. Typically shorted than the development time
There are indeed better Python alternatives, but very few use them in comparison
The intersection of people who enjoy both C# and Python is very small. I too have worked a soul-sucking job in finance and use of languages like Java and C# was a big part of what I didn't like.
It seems there are two ways to react to the "I don't get" situation:
1. Other people must be wrong in the head to like this,
2. I don't have the knowledge and/or experience to understand why other people like this.
In life I find it's generally better to give the benefit of the doubt and take the second path. But you may still conclude it's the first after all. All I can say is I'm grateful there are others who are wrong in the head like me and prefer Python for whatever reason.
It's true that many users avoid them, though, but that's more of a cultural issue, and seems to be more common among DS/ML folk.
It really boggles my mind why is this lang so popular. Once you write something a little more involved than an utility script or jupyter notebook you start dealing with stupid problems like
- venv
- no standard package manager, dependency resolution taking forever
- multiprocessing
- untyped libraries (looking at you boto)
- `which python`
- wsgi
- CLI debugging
et cetera.
I'm currently working daily with Python, and compared to the .NET world I'm coming from, it's MINDBLOWING how many things are annoying here. In my previous job I was able to spend several years working on a C# app barely ever needing to touch the terminal, everything came with batteries included, tooling / autocompletion / package management / performance / time spent on dealing with little issues was REALLY good in comparison.
Reason I moved is that it's hard to find a job in C# which isn't soul sucking stuff like banking / maintainance / insurance, so I'm dealing with it as the project is interesting at least.