Python is popular because it’s whitespace based syntax make noobs think it’s easy to read. This and it’s pre-installation on Linux made it popular amongst academics who embraced it for data analysis. This lead to a lot of data scientists embracing it and writing libraries for it which created a virtuous cycle in that arena.
And it’s a damn shame because Python, and it’s whitespace nonsense and lack of type system, is a horribly impractical language for building anything at scale.
White space nonsense. Yes and no. I do not enjoy tracking down white space issues until I remember the alternative. Matching brackets, writing begin/end statements, and worst of all looking at code that appears well indented until later you find it is not. and it runs totally differently then it looks. Similar issues with semicolons.
Pretty much everyone uses LSEs these days so frankly matters less either way most of the time.
It does make it easier to read. We primarily use indentation to match brackets, so clearly, indentation is the most important readability feature between the two, not brackets.
Try reading the same piece of code: without brackets, and then without whitespaces and tell me which is better.
Whitespaces as syntax force you to indent your code properly and not be misleading.
Brackets are infinitely easier because any IDE (and most text editors) have a dead simple linting plugin which auto indents for you and lets you know when you fucked up. Your editor can barely do anything with whitespace only because everything is valid syntax.
Also lemme take this opportunity to say fuck yaml for exactly this reason.
I literally do that professionally, and I’m telling you that brackets are inarguably better.
You are used to whitespace; I have literally spent months refactoring and upgrading a react frontend and a python backend and am telling you that brackets are a single character and far more predictable, and then your IDE / Linter / Formatter can reliably use them to fill in the perfect indentation and whitespace.
My first professional language was Python, but I have since tried a half dozen others and would never choose to go back to a whitespace based language unless there was a good reason.
I’ve written C, JS, PHP, and a few others. Today I write Python almost everyday and wouldn’t trade it for any of them. Maybe Rust, but not because of brackets.
Typing thing is way over blown. What did suck before Python 3 was indeterminate type result from the / operator. You never know if it would be integer or floating division looking at the code. Now it is floating.
Not only data science libraries, there is a library for about anything. Which is not the case for your list of languages.
Java has an excellent ecosystem for libraries. And a much more mature one in most cases than Python. The Spring framework alone is simply amazing.
Go’s ecosystem is pretty good as well and getting better.
When you understand how python works, it’s quite simple to use too, and has lot less clutter than say java or c#.
The problem is that many python devs consider things like “type hints” and “classes” to be “clutter”. It takes a lot of discipline to write managable python. Being “newb friendly” is a curse. “stringly typed” crap does NOT scale well.
It can scale though. It parallelizes really well if you use queuing systems to distribute the load. You just have to make sure that the hot loops are in C/C++, and it is very easy to interface with compiled binaries via the C API.
Agreed. I have seen a lot of Python code that was really painful to massage back into a more structured object hierarchy. Java certainly does a bit better in that respect, and as a language, it does a much better job of encouraging better practices, but I think it’s also largely due to the kinds of people that use those languages as well.
Python is popular because it’s whitespace based syntax make noobs think it’s easy to read. This and it’s pre-installation on Linux made it popular amongst academics who embraced it for data analysis. This lead to a lot of data scientists embracing it and writing libraries for it which created a virtuous cycle in that arena.
And it’s a damn shame because Python, and it’s whitespace nonsense and lack of type system, is a horribly impractical language for building anything at scale.
White space nonsense. Yes and no. I do not enjoy tracking down white space issues until I remember the alternative. Matching brackets, writing begin/end statements, and worst of all looking at code that appears well indented until later you find it is not. and it runs totally differently then it looks. Similar issues with semicolons.
Pretty much everyone uses LSEs these days so frankly matters less either way most of the time.
It does make it easier to read. We primarily use indentation to match brackets, so clearly, indentation is the most important readability feature between the two, not brackets.
Try reading the same piece of code: without brackets, and then without whitespaces and tell me which is better.
Whitespaces as syntax force you to indent your code properly and not be misleading.
Brackets are infinitely easier because any IDE (and most text editors) have a dead simple linting plugin which auto indents for you and lets you know when you fucked up. Your editor can barely do anything with whitespace only because everything is valid syntax.
Also lemme take this opportunity to say fuck yaml for exactly this reason.
I literally do that professionally, and I’m telling you that brackets are inarguably better.
You are used to whitespace; I have literally spent months refactoring and upgrading a react frontend and a python backend and am telling you that brackets are a single character and far more predictable, and then your IDE / Linter / Formatter can reliably use them to fill in the perfect indentation and whitespace.
My first professional language was Python, but I have since tried a half dozen others and would never choose to go back to a whitespace based language unless there was a good reason.
I’ve written C, JS, PHP, and a few others. Today I write Python almost everyday and wouldn’t trade it for any of them. Maybe Rust, but not because of brackets.
Instagram’s back bone is written in python. I’d say that’s pretty scaled.
No, it’s not. It was rewritten in Facebook’s version of PHP when they bought them.
Here’s a blog post from meta, they introduced immortal objects to python to help with their Instagram scaling.
https://engineering.fb.com/2023/08/15/developer-tools/immortal-objects-for-python-instagram-meta/
Huh, TIL, I didn’t realize they kept the gateway servers in Python.
Typing thing is way over blown. What did suck before Python 3 was indeterminate type result from the / operator. You never know if it would be integer or floating division looking at the code. Now it is floating.
It’s not made for scale. Use C/C++ or something if you want scale.
Or you know, TypeScript, Go, C#, Java, Swift, etc. etc.
Python isn’t great at anything except for having a lot of data science libraries already written for it.
Not only data science libraries, there is a library for about anything. Which is not the case for your list of languages.
Edit: not all languages in the list.
When you understand how python works, it’s quite simple to use too, and has lot less clutter than say java or c#.
Java has an excellent ecosystem for libraries. And a much more mature one in most cases than Python. The Spring framework alone is simply amazing.
Go’s ecosystem is pretty good as well and getting better.
The problem is that many python devs consider things like “type hints” and “classes” to be “clutter”. It takes a lot of discipline to write managable python. Being “newb friendly” is a curse. “stringly typed” crap does NOT scale well.
It can scale though. It parallelizes really well if you use queuing systems to distribute the load. You just have to make sure that the hot loops are in C/C++, and it is very easy to interface with compiled binaries via the C API.
So can assembly. But it takes a tremendous amount of discipline.
Python’s curse is that it’s popular with “newbs” who think it’s okay to use dictionaries for everything and that type hints are “clutter”.
Agreed. I have seen a lot of Python code that was really painful to massage back into a more structured object hierarchy. Java certainly does a bit better in that respect, and as a language, it does a much better job of encouraging better practices, but I think it’s also largely due to the kinds of people that use those languages as well.
Instagram runs on django.
It has optional typing
It has optional type annotations for use by linters*
Good point!