BartWronski ,
@BartWronski@mastodon.gamedev.place avatar

1/5 Why is Python my favorite and "goto" general-purpose programming language?

Let's get first things first - every language has trade-offs and satisfies only some "general" requirements.
We need many languages for multiple goals, such as performance, safety, control, abstraction, flexibility, convenience, simplicity, platform/hardware, legacy code, hot reload/no compilation vs. ensuring precompilation, type safety, etc.
Some are contradictory!

BartWronski OP ,
@BartWronski@mastodon.gamedev.place avatar

2/5 So, let's not look for a perfect one; it's impossible.
DSLs and different languages will always exist.

Then, what do I look for in a "general" language, knowing that it may compromise some of those general goals?
I want a vast ecosystem with libraries for "everything," the ability to prototype ideas quickly, flexibility, conciseness, multiple paradigms, easy debugging and visualization, quick exploration, testing other people's code, and finally, easy interop with other languages.

BartWronski OP ,
@BartWronski@mastodon.gamedev.place avatar

3/5 Despite its many limitations and design flaws/trade-offs, Python fullfils all those mine goals.

I can use a single language for explorations and then branch out (with custom modules) or switch to other languages.
I can script shell-like tasks.
I can launch repl for quick tests.
I don't need to create projects and set up tools to test 2 lines of code.
It is very readable (you might debate this point due to some limitations, but conciseness and abstraction correlate with readability).

BartWronski OP ,
@BartWronski@mastodon.gamedev.place avatar

4/5 With Python typing, IDE support is excellent, and I can use as much typing as I feel like for a task.
Most recent papers' code and research are in Python - it's ubiquitous.
It supports most (all - when we include libraries) programming paradigms.
Numerical libraries are amazing. (I still don't like sympy and probably never will; Mathematica wins for symbolic).
It has excellent high-performance libraries for specific tasks, or one can use it with CUDA, numba, or C++ modules.

BartWronski OP ,
@BartWronski@mastodon.gamedev.place avatar

5/5 Platform-independent interop could be better; there are alternative ways with their trade-offs, but it is still relatively painless.
Notebooks are great for exploration and visualization (even if not as good for dynamic ones as Mathematica).
You will disagree with my points and you have different requirements for your work — I understand and will not try to convince you to like it.
But I feel very productive and "at home" with Python. I don't need to context switch. I can get stuff done. :)

przemoc ,
@przemoc@fosstodon.org avatar

@BartWronski
Yeah, the more I use Python over years, the more I like it (even though I still hate strict spacing rules for instance). I was late with starting to use Jupyter notebooks, but they're such a great tool for reproducible exploration, playing with data, prototyping and visualizing. You can share .ipynb file with others, they can easily load it in vscode, follow or redo your thought process and actions. Such a low friction tool, and the older you get, the more you appreciate that.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • tech
  • kbinEarth
  • testing
  • interstellar
  • wanderlust
  • All magazines