HACKER Q&A
📣 Nickydigit

Which alternative to Python for personnal use would you recommend?


As a professional fullstack dev that specialize in PHP backends (Symfony and Laravel mostly) and does a bit of Bash when required, I am looking for a general purpose programming language to use for fun little personal projects at home (essentially API consuming, local LLM use and I/O interactions through either websockets or similar tools)...

... that isn't Python !

I had a really bad first experience with the language and find it quite messy in terms of syntax and debugging, so ideally I would like to avoid it.

Looking at popular and/or similar languages, I found quite a few that seems like they could match what I am looking for, but I would love to have some feedback from people who used them in order to make an educated pick.

Here are the languages :

- Rust (seems rather complex and inadequate for "fun little projects on the side" but powerful) - Go (fast, reliable, with quite a few community packages to extend its capabilities) - Ruby (a personal preference probably because I am using PHP at work, syntax looks really appealing)

- Kotlin (apparently good for GUI, much more than Rust for example, surprised that it was recommended but who knows...) - Lua (another one that was recommended to me, could be useful as I am also interested in modding some games in the future)

Thanks in advance for your feedback and help :D


  👤 pansa2 Accepted Answer ✓
If you're looking for a high-level scripting language for small projects that you keep to yourself, Ruby is the obvious alternative to Python. Lua not so much - it's fine when embedded but doesn't have the ecosystem for standalone use.

However, if you want to make programs for others to download and use, I'd recommend a language that can be compiled into easily-distributable binaries. As long as the overhead of a garbage collector is acceptable, Go is the clear favourite here.


👤 BiteCode_dev
This list is not meant to say "this is the best language for this", but rather, "you'll have an interesting learning experience with this":

- web backend => ruby (with RoR)

- web frontend => JS

- network => go

- gui => dart

- perf sensitive => rust

- mac os only => swift

- windows only => F#

- cli scripting => nim

- embed => zig

- new perspective on programming => lisp

- want to experience clean theoretical concept => haskell

- need super reliable service => erlang

- lots of data processing => julia

- lots of number exploration => j

- video game => C# (with unity)

And I say this as someone who would likely use Python for 80% of those.


👤 neonsunset
You will probably like .NET's CLI tooling after Python:

    brew install dotnet-sdk
    # or
    sudo dnf/apt install dotnet-sdk-8.0
    dotnet new web
    dotnet run
    curl localhost:5050
C# will give you, in some ways, Python-esque experience if you make many one-off programs as you can simply write Main as python script but with 10-50x performance. You can also go very low-level with C syntax with unsafe, or take a middle ground with performance-oriented APIs - it's a language closer to the metal than Kotlin or Go.

To build a native binary, just make a template with --aot arg. like dotnet new console --aot or do dotnet publish -p:PublishAot=true -o. {folder} (if template doesnt have it). .NET 8 build toolchain sometimes not the fastest (it's seconds but still) but .NET 9 improves upon that quite a bit.

Great for back-end, gamedev, crossplat GUI apps, low-level data-crunching with SIMD and high-level data crunching with Parallel and Task APIs, all kinds of background daemons.


👤 beardyw
Recently taught myself Python and now I just love it. Sorry you had a bad encounter with it.

👤 cdaringe
I authored this site to help with this exact question:

https://cdaringe.github.io/programming-language-selector/

Try it out, give me (friendly) feedback!


👤 the__alchemist
Rust. Adequate for fun little projects on the side; I find the extra setup time pays itself off in bug prevention and diagnosis quickly, even on small projects. I feel confident my Rust code will have few runtime errors, mutations are predictable etc, while I know my Python code is a minefield, even with precautions like typing. Overall reasons I prefer Rust as a default over Python for most projects:

  - Better (best IMO) official tools
  - Catch many error types at compile time
  - Predictable mutation/pass-by-value vs ref
  - No speed limits
  - Easy to distribute (compared to Python)
All the downsides you've heard about rust are probably true. But when you weigh it as a whole and look at the downsides of other tools, IMO rust rises to the top for many uses.

Kotlin is IMO kind of a mess; too many Javas complications. I may be biased by only having used it for Android.

Important caveat: You mentioned you focus on backends. I can't recommend rust for that due to the immature ecosystem; if you are looking for something like Flask, it is fine. If you want a Django/Rails/Laravel analog, there is nothing that exists on that tier. I recommended it because you're looking for something more general.


👤 Malidir
Python has lots of libraries, and is known as the 'second best language for everything' so suck it up and learn a bit to complement your PHP. You don't need to learn it comprehensively- just a bit. (Alternatives to python are c# or Java).

Then I woudl say invest the time to learn Rust, as a long term strategy.


👤 leros
I do almost everything in Typescript these days. Is it the perfect language? No. Are there libraries for everything? Yes. Is it easy to run? Yes.

The bonus is that I'm using Typescript for front-end development anyway, so using TypeScript for my backend and scripts just simplifies everything I do into one language.


👤 pona-a
Racket and Clojure are, in my opinion, well-designed, pragmatic languages that get to the point quickly and elegantly.

Clojure is a great opinionated functional language with a healthy ecosystem and a real job market. I now solve Advent of Code-style puzzles mainly in Clojure. Its only significant drawback, which is also its biggest feature, is the JVM. While it gives you interop with Java's ecosystem and lets you benifit from one of the fastest GC runtimes, it can leak its quirks into your program.

If interpreter start-up times are a concern, Babashka is an alternative Clojure interpreter based on GraalVM, with a startup time of about 30ms, making it perfect for UNIX scripting with a real programming language. For browser or Node dev, ClojureScript is an official dialect with a few minimal compromises given its runtime.

It also includes many useful additions like Actor concurrency model, transducers, multimethods, records, and EDN (Extendible Data Notation).

The only real objection is that Clojure isn't quite a Lisp, deviating from the definition in key ways, such as not using cons cells. However, this is not a concern outside an educational context.

Racket is essentially a modern Scheme dialect, adding many of its own niceties while not strictly following RnRS standards. It has an excellent contract typing system, #lang feature that allows you to define your own DSLs, tools for lazy and reactive programming, and a batteries-included standard library with plotting, GUI, statistics, and more, all while still being a true Scheme, which igves you other neat features like numerical tower, TCO, first class continuations, and with #lang and other interop tools, the ability to reuse run most normal Scheme code. Fun fact: HackerNews is written in Arc, a Lisp dialect, now implemented as within Racket.

Both languages have uniquely excellent documentation, use the regular and flexible syntax of S-expressions, and possess powerful macro systems. Both are equally useful and fun tools.


👤 tiberious726
This is hackernews, common lisp is the standard suggestion for personal projects. Especially if you found the debugging experience in Python lacking. It's not on your list, but definitely worth taking a look.

👤 darkotic
You didn't say that isn't PHP, so can we explore that further? I write a lot of my own little php shell scripts to do things. I use laravel zero for a framework of related tools. I wrote a cli RAG app for LLMs using it. You might look into TUIs people are coming out with like from Charm.sh, written in Go.

👤 speedgoose
Ruby is the closest match from Python and PHP. Have you considered JavaScript too?

👤 somesun
rust is good , if your want to release your work

I hope python have tools like cargo to release binary in one command


👤 notemaker
Elixir is really fun. It hits the same spot for me as Ruby does for many others, bringing joy when writing it.

👤 gjvc

👤 maremmano
Go Lang. Look no further :)

👤 bilsbie
I’d say give python another chance. What happened exactly?

👤 bawolski
V lang