Live data from Hacker News

Ask HN: Which alternative to Python for personnal use would you recommend?

news.ycombinator.com

11–20 of 38 posts

Re: Ask HN: Which alternative to Python for personnal use would you recommend?

#11

Earlier quoted context omitted.

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...

Re: Ask HN: Which alternative to Python for personnal use would you recommend?

#12
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.

Re: Ask HN: Which alternative to Python for personnal use would you recommend?

#13

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 =…

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.

Re: Ask HN: Which alternative to Python for personnal use would you recommend?

#14
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.

Re: Ask HN: Which alternative to Python for personnal use would you recommend?

#15

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 =…

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.

Re: Ask HN: Which alternative to Python for personnal use would you recommend?

#16

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.

Re: Ask HN: Which alternative to Python for personnal use would you recommend?

#18
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.

Re: Ask HN: Which alternative to Python for personnal use would you recommend?

#20
post #14

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 gar…

There's also Crystal for the compiled usecase.
Post reply on HN