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 have considered Python many times, but I cannot work with a language that considers whitespaces as required syntax. I just cannot work with it.
Why I Switched from Python to Clojure (2016)
51–60 of 200 posts
Re: Why I Switched from Python to Clojure (2016)
#52Earlier quoted context omitted.
Only if you don't consider a forest of parens to be noise. I do. I'm sure I could get used to it after a while, but at first glance, Python code is definitely cleaner than Lisp.
It's not a "forest of parens" any more than any language with C style syntax is, they're just in different places (the correct places) and there's no need to distinguish with braces (which you shouldn't need to).
I studied Lisp and Scheme at university and that’s where it had to remain for me: academically entertaining mind puzzles in data structures and algorithms. It’s just not productive or easily graspable from one coder to another.
Re: Why I Switched from Python to Clojure (2016)
#53Earlier quoted context omitted.
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
The problem is that Python is the exception here. Those of us that learnt other languages first already have a mental model and find this explicit self parameter weird. And it's more typing. Yegge thinks that "self" is a wart and I agree. The article is a fun read but it's showing its age. I suspect Python might just have beaten Perl by now. https://sites.google.com/site/steveyegge2/tour-de-babel#TOC-... I suppose Py…
class Foo:
b = 4
def foo(self, a):
return a + self.b
inst = Foo()
inst.foo(3)
Foo.foo(inst, 3)
I haven't written python in a while, but I really like that python makes this possible and obvious and I've found this behavior pretty handy when working in a more functional style.Re: Why I Switched from Python to Clojure (2016)
#54Earlier quoted context omitted.
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
I think the way Lua handles it is much better. If you have object foo of class Foo with method bar, accessing it like foo.bar does no magic on it. You would have to call it as foo.bar(foo, ...) if you wanted to access the method with a dot. Only foo:bar will do the magic on it. If you call it as foo:bar(...) then the object will be passed to the first parameter. This follows "explicit is better than implicit" much be…
Re: Why I Switched from Python to Clojure (2016)
#55I can, and do, appreciate opinions on languages themselves. But my decision to continue using Python over Clojure is much less about the language's syntax and more about the available libraries. How do Clojure web frameworks compare to Django/Flask? What would I use instead of Pandas for data analysis? Are there keras-like deep learning tools? Switching languages based on a comparison of idiosyncrasies between the tw…
I know choosing the right tools for the task can have serious long-term implications on the project, team, or organization level, but individually I get the impression that people worry too much about which language is best when, in reality, many of them are perfectly suitable and appropriate.
Re: Why I Switched from Python to Clojure (2016)
#56Earlier quoted context omitted.
The problem is that Python is the exception here. Those of us that learnt other languages first already have a mental model and find this explicit self parameter weird. And it's more typing. Yegge thinks that "self" is a wart and I agree. The article is a fun read but it's showing its age. I suspect Python might just have beaten Perl by now. https://sites.google.com/site/steveyegge2/tour-de-babel#TOC-... I suppose Py…
I also like how you can call the method on the class and pass self in explicitly. e.g.: class Foo: b = 4 def foo(self, a): return a + self.b inst = Foo() inst.foo(3) Foo.foo(inst, 3) I haven't written python in a while, but I really like that python makes this possible and obvious and I've found this behavior pretty handy when working in a more functional style.
These days, however, I mostly write Common Lisp and Clojure which, each in their own way, have explicit selfs: Common Lisp because it uses multiple dispatch and, consequently, there isn't one "self" and Clojure's protocols are designed to dispatch on the first argument, which is always passed explicitly.
Re: Why I Switched from Python to Clojure (2016)
#57Earlier quoted context omitted.
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.
You will shoot yourself in the foot less often with Lisp parens than you might with Python whitespace. Most modern editors handle the closing parens anyway. Plus, many editors without any plugins can jump between matching braces; so moving around the code is very quick compared to Python (unless you have a Python plugin that has block movement shortcuts).
I'm not letting that stand ;-)
In my experience Python's whitespace generally removes sources of scope/block errors compared to parenthesis and curly-based languages
> unless you have a Python plugin that has block movement shortcuts
Not sure what this means. The only support I need in an editor is the ability to use tab and shift tab on blocks of text to change the indentation level. It's visually obvious when code is correctly indented.
Re: Why I Switched from Python to Clojure (2016)
#58I can, and do, appreciate opinions on languages themselves. But my decision to continue using Python over Clojure is much less about the language's syntax and more about the available libraries. How do Clojure web frameworks compare to Django/Flask? What would I use instead of Pandas for data analysis? Are there keras-like deep learning tools? Switching languages based on a comparison of idiosyncrasies between the tw…
Flask -> pedestal/clojupture
Relay -> fulcro
Pandas -> clojure.core, specter
Keras -> mxnext/neanderthal
Re: Why I Switched from Python to Clojure (2016)
#59I can, and do, appreciate opinions on languages themselves. But my decision to continue using Python over Clojure is much less about the language's syntax and more about the available libraries. How do Clojure web frameworks compare to Django/Flask? What would I use instead of Pandas for data analysis? Are there keras-like deep learning tools? Switching languages based on a comparison of idiosyncrasies between the tw…
Similarly, when connecting to a database like Oracle, it's trivial to just use JDBC/etc. while, for example, my coworkers who are using Haskell generally have to write a Java gateway because there aren't well-tested clients for Haskell.
Re: Why I Switched from Python to Clojure (2016)
#60Earlier quoted context omitted.
This is just blaming people for using Clojure's features though. If deep JVM integration wasn't a selling point, you'd use a vastly more mature Lisp, right?
A lot of us use Clojure despite the JVM, not because of it. Closure has a lot of (other) compelling features.