Python is the second best language for anything¶
| python |
Main Part¶
Disclaimer: It’s another blah-blah post, feel free to read Hacker News :-P it will be more useful for you.
What other programming languages do I associate with Python, or to be precise what other scripting languages? I would say the following:
- Ruby
- Groovy
- Javascript
- Perl
- PHP
- Lua
- Tcl
- Bash (and similar shell scripting languages)
- Powershell
- VBA
- Autohokey
- AutoIt
- newLISP
- R
- Matlab
- Maple
Actually, I decided to make this list only as an exercise for myself, to identify from a historical perspective what I touched during all these years.
I used some of these languages at the university or early in my career. I.e. I don’t know the status quo for them, new features, their communities, etc. But all of them somehow build Python-association in my brain in a way I can use Python instead of them and be “happy”. If you look closer at this list you will notice some domain-specific language (like GUI automation, scripting, and math tools).
But the true Python competitor in general sense is Ruby. These two are very similar in terms of exploitation, and I preferred Ruby before my personal Python era began.
I was not too fond of Python. But since everybody around me has been using Python in some or another way, I decided to use it as well, to simplify knowledge/tool sharing, contribution to other tools, etc. Even today, I am not a big Python fan, but there is convenience: a massive amount of libs, books, blogs, etc. It’s like a universal hammer for everything.
So, what does it mean “Python is the second best language for anything” for me?
It means I will start prototyping any simple things, or throw-away scripts in Python. Even if I don’t know the domain I am 99% sure there is at least some library for my current problem.
There are several exceptions:
- Web: Javascript
- System Programming: C
- Back-End: Go, Java, Scala
- CLI: Go
- Desktop: Java
The following domains will be covered by Python (PoC, my personal projects):
- Scripting
- Infrastructure
- Machine Learning/Data Science/Data Analysis/Data Engineering
- CLI: when I don’t need to distribute the app
Again, Python is not the best language in the world, it definitely has some sort of ugliness, but it’s popular, and I accepted this.
Concerns¶
Concurrency¶
This topic is not well aligned in my head when I am talking about Python and concurrency in the same sentence. I would use JVM languages (Java, Scala) or Go instead of Python when I need to implement something performant and concurrent.
Packaging and Distribution¶
It’s not related to Python only, but to other scripting languages as well. If you need to distribute some Python app you have to be prepared. Your users must know how to use Pip and virtual environment. But it’s not the end of story.
How do you package/assemble your app? There are so many ways for building your Python app, see PyPA Projects. I don’t understand why such old community hasn’t agreed on some recommended build tools. Why do they need such crazy numbers of different tools? But I am talking as seasonal Python user. Maybe there are some reason. Anyway, what I wanted to say: I try to avoid as much as possible any Python tools ceremonies and use only simplest possible standard tools: pip
, venv
and requirements.txt
.
Just check Distributing Python Modules, and you will find such creatures: distutils, setuptools, wheel and so on. What? Really?
Do not forget, Python went public in 1991 (31 years ago). FTW!
P.S. Poetry is a new cool kid in Python community. Maybe it will solve all problems, but it’s not yet a standard and that’s why I am not ready for big investments.