Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Which alternative to Python for personnal use would you recommend?
20 points by Nickydigit 4 months ago | hide | past | favorite | 37 comments
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




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.


I do wish Lua saw more widespread use as a general scripting language. I find it's simplicity refreshing compared to Python


There's also Crystal for the compiled usecase.


An important note: If you plan on sticking to an editor that has LSP integration like Vim/VSCode and so, stay away from Ruby as Ruby's language server solargraph is just not good. Personally, this is my main reason for staying away from languages like Ruby, Kotlin etc.


I will keep it in mind, though a quick search returned a project that resemble LSP integration for Ruby : https://github.com/Shopify/ruby-lsp.

Also RubyMine (IDE from Jetbrains) seems to have its own LSP integrated.


There are some limitations with ruby-lsp. I'd recommend checking some sources to identify if any would be a dealbreaker.


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.


How is Nim for cli scripting? I tend to use Bash for simple scripts, and Python once I need more than one command line argument. I've been looking for a compelling case to try out Nim.


It's Python-like, but it compiles, so you get a stand alone exec like go, that you can copy on other machines without having to provide an interpretter.

It's better than bash for anything longer than 5 lines, works on Windows and Unix and has a lean syntax.

Now I would use Python for scripting, especially since uv and hatch have inline deps support now, so it's a blast.

But OP is looking for something new, so I list things he may enjoy learning, in a context that would make it enjoyable to learn.


When making small Nim programs for the CLI, https://github.com/c-blake/cligen makes for a pretty simple API (just 1 line of code) that gets you nice CLI syntax, color auto-generated help messages, etc.


Swift is not Mac OS only, it’s actually cross platform. Maybe you’re referring to Mac OS/ios swift sdk that is platform specific


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.


> Python-esque experience if you make many one-off programs as you can simply write Main as python script

For simple scripts, you don't even need to bother with a `Main` method anymore; you can just write statements outside of any structure like in PHP or JS: https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals...


Thanks for the run down !

Though I was under the impression that C# was closely related to Microsoft services and thus Windows OS ?

Not that I mind as I also run Windows on my personal machines but could be an issue for specific projects if it was the case.


It hasn't been the case for about 8 years already :) And even before that with Mono!

The windows-only thing is a sad lie spread by people with irrational dislike to something that can make their life much better.

I daily drive it with macOS and it's awesome, a friend of mine uses it with Neovim and csharp-ls.


I see !

I will look into it as I did a bit of Java and a tiny bit of C# during my education and liked both the syntax and the OOP approach !


Just a note that C# DevKit extension in VS Code is not needed. You only ever need base C# extension[0] which gives you code completion, navigation, etc. with Roslyn LSP. Other than that, I recommend skipping complex UIs in VS or Rider for building projects for now and just using CLI - it's a much more streamlined experience.

With that said, if you have JetBrains license, Rider is great and works everywhere if you prefer rich IDE approach.

For debugging when you press F5 in VSC, it will offer you to create build and debug config - just say yes and pick the project. It will launch it next time you press F5.

[0]: https://marketplace.visualstudio.com/items?itemName=ms-dotne...


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


I taught myself Python as my first language and now I’m starting feel that there are core coding concepts that Python abstracts away from the user that are probably important to know for good code hygiene.

That being said, for personal projects that don’t really see the light of day, Python is a perfect multi-tool type language


I authored this site to help with this exact question:

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

Try it out, give me (friendly) feedback!


I tried it just now, my main issue is that I am looking for a general purpose language and you can only select a single use case with your tool :/


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.


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.


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.


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.


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.


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.


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


I am already using Javascript professionally and for Discord bot development through node.js

Ideally I would like to have another language in my dev pocket and take a break from the languages I use at work.

Also Javascript doesn't seems like a good choice for desktop apps (apart from Electron that suffers in the performance field) or CLI tools (unsure about this one as I never used it in this field) does it ?


If you are chasing the best performances for desktop applications. You shouldn't really look at Python alternatives. In my opinion, JavaScript and Chrome performs quite well in practice. Plenty of successful apps use that kind of stack with good performances.

CLI in JavaScript wouldn't be my first choice, Python would, but some people do that too.

If you want to take a break from the languages at work, maybe learn a language for fun. Ruby is great and fun to learn. Golang is quite quick to learn if you don't have much time. Rust is my personal favourite but it's more challenging. And then you have all those exotic programming languages or some with different paradigms.


For desktop apps you could try Godot with C#.


rust is good , if your want to release your work

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


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



Go Lang. Look no further :)


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


V lang




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: