Live data from Hacker News

Why I Switched from Python to Clojure (2016)

bradcypert.com

11–20 of 200 posts

Re: Why I Switched from Python to Clojure (2016)

#11
post #4

I have considered multiple times switching from Python to other alternatives. However, I instantly discard any language with a Lisp-like syntax. I just cannot work with it. Being a Haskell hobbyist, I would like Python to be statically type and have better support for pure functional programming, but Python has the libraries that I need.

I far prefer Haskell to Clojure myself but I will say: once you get half-decent at paredit, no syntax even comes close to Clojure’s.

Indeed, if you really want fun, try Hackett: a Haskell variant implemented in and for Scheme.

Re: Why I Switched from Python to Clojure (2016)

#12
post #4

I have considered multiple times switching from Python to other alternatives. However, I instantly discard any language with a Lisp-like syntax. I just cannot work with it. Being a Haskell hobbyist, I would like Python to be statically type and have better support for pure functional programming, but Python has the libraries that I need.

You could try parinfer, it effectively turns lisp (clojure) into a whitespace significant language like python.

You still get the great “execute this block of code in the repl” with the parens too.

Re: Why I Switched from Python to Clojure (2016)

#13
post #4

I have considered multiple times switching from Python to other alternatives. However, I instantly discard any language with a Lisp-like syntax. I just cannot work with it. Being a Haskell hobbyist, I would like Python to be statically type and have better support for pure functional programming, but Python has the libraries that I need.

Just think of the parenthesis as loving warm homoiconic hugs.

Hehe, when teaching my 8yr-old programming (in Python) I call (function call) parenthesis a hug to explain that a function "hugs" all arguments to it. She seems to get that :).

Re: Why I Switched from Python to Clojure (2016)

#14
post #8

I notice this was written in 2016, but I wonder if the author's opinion has changed since dataclasses have been implemented in Python.

Python's async support also seems to be getting better. There's a flask clone called Quart ( http://pgjones.gitlab.io/quart/ ) and an async postgres client ( https://github.com/MagicStack/asyncpg ). It works very similar to JavaScript, with async and await keywords. I think it should provide speed and comfort especially if you're a regular JavaScript user.

I wrote a pretty substantial experiment using asyncio for 100k websocket client connections across a massive theoretical fleet of robots. It's not open source but the general result was that I used to hate async in Python and now I love it.

The syntax makes blending sync and async easy. And the cooperative multitasking paradigm is very easy to reason about. No locks!

Re: Why I Switched from Python to Clojure (2016)

#15

> ...the “implied self parameter” on python methods turned me off. If I had a nickel for every time I got the "TypeError: random_function() takes 1 positional argument but 2 were given" because I forget the "self" parameter I could buy myself a coffee. Probably a fancy one from the Starbucks even!

I always thought this made sense: a method, considered as a property of a class isn’t yet bound to any particular instance while, considered as a property of an instance has an implicit parameter of the instance you’re currently operating on: languages like Java hide this “this” parameter from you by passing it automatically while python makes it explicit so you can form a better mental model of what’s going on

Re: Why I Switched from Python to Clojure (2016)

#16
post #12
post #4

I have considered multiple times switching from Python to other alternatives. However, I instantly discard any language with a Lisp-like syntax. I just cannot work with it. Being a Haskell hobbyist, I would like Python to be statically type and have better support for pure functional programming, but Python has the libraries that I need.

You could try parinfer, it effectively turns lisp (clojure) into a whitespace significant language like python. You still get the great “execute this block of code in the repl” with the parens too.

Hey look it's the coast guy :)

Re: Why I Switched from Python to Clojure (2016)

#17
post #4

I have considered multiple times switching from Python to other alternatives. However, I instantly discard any language with a Lisp-like syntax. I just cannot work with it. Being a Haskell hobbyist, I would like Python to be statically type and have better support for pure functional programming, but Python has the libraries that I need.

I haven't got much experience with Lisp, but I can imagine that, similarly to Python's significant indentation, it's a shallow weirdness that can be overcome easily after a little while. In both cases a little help from the editor will probably be needed.

Re: Why I Switched from Python to Clojure (2016)

#18
post #4

I have considered multiple times switching from Python to other alternatives. However, I instantly discard any language with a Lisp-like syntax. I just cannot work with it. Being a Haskell hobbyist, I would like Python to be statically type and have better support for pure functional programming, but Python has the libraries that I need.

"I instantly discard any language with a Lisp-like syntax. I just cannot work with it."

I feel the opposite. I avoid any language without a Lisp-like syntax, since its absence is a serious handicap which unnecessarily complicates code and makes it less readable.

I also much prefer the Lisp idiom of using meaningful function and variable names, vs the one-letter names and crypitic operators that are so common in Haskell, OCaml, and SML.

Re: Why I Switched from Python to Clojure (2016)

#20
post #4

I have considered multiple times switching from Python to other alternatives. However, I instantly discard any language with a Lisp-like syntax. I just cannot work with it. Being a Haskell hobbyist, I would like Python to be statically type and have better support for pure functional programming, but Python has the libraries that I need.

Just think of the parenthesis as loving warm homoiconic hugs.

[deleted]
Post reply on HN