6 ms·
I have recently been learning python after primarily coding in Clojure and Ocaml the last 36 months. It has been a pretty frustrating experience, lots of the t
by bgorman 6y ago
I have recently been learning python after primarily coding in Clojure and Ocaml the last 36 months.
It has been a pretty frustrating experience, lots of the tools from functional languages are there, however Python as a language is extremely inconsistent. All these little quirks take up a significant chunk of cognitive overhead. Python also liberally add different syntax in places where it doesn’t seem to add much value (eg lambdas cannot destructure tuples, and don’t need to use return). Python has really showed me the value of keeping a simple syntax, and having value semantics everywhere). Mutation just isn’t a great way to write code outside of leetcode.
- macintux 6y agoFunctions (and I assume lambdas) could destructure tuples in Python 2.x. I started my first serious Python project in 2.something before discovering it was nearly eol, and learning that all of my tuple management was broken under version 3 was quite demoralizing. I find the mutability of values and object orientation of 3rd party libraries to be among the most alienating aspects of Python, but overall it’s too useful for me to ignore, so I live with it. I just don’t find layering on functional capabilities to an OO language to be nearly as useful as a true FP solution. As you said, too much cognitive overhead.
- BalinKing 6y agoHuh, apparently[0] they removed lambdas' ability to do that in Python 3! [0] https://stackoverflow.com/a/11328422/2391244 https://stackoverflow.com/a/11328422/2391244
- xapata 6y agoI'm not sure why they removed the ability to destructure sequences in args. It bugs me sometimes as well. There's probably a long discussion about the rationale in some PEP and an even longer email thread.
- mesaframe 6y agoThey did? Afaik, it's there.
- pansa2 6y ago> There's probably a long discussion about the rationale in some PEP PEP 3113 -- Removal of Tuple Parameter Unpacking: https://www.python.org/dev/peps/pep-3113/ https://www.python.org/dev/peps/pep-3113/
- xapata 6y agoThat's a decent argument. It's more typing (in both senses!) to use a specific type as the parameter instead of unpacking in the signature, but it's just as or more readable that way.
- carapace 6y agoYeah, I was so bummed when they did that. I had a whole library of functions for a stack-based interpreter that destructured the stack in the function sig, and it was sooooo coooool... def add((a, (b, stack))): return a + b, stack def uncons(((head, tail), stack)): return tail, (head, stack) &c...
- bmitc 6y agoI fully agree with you and have expressed this sentiment many times. I use Racket and F# in my spare time, basically sister languages to what you use (!), and I have the same opinions. Knowing these other more structured, consistent, and principled languages makes Python a frustrating and difficult experience. Whenever I program in Python, never by choice, it's an exercise in unlearning sanity. Knowing these other languages and with others like them out there (F#, Racket, Clojure, OCaml, Elixir), I have no practical or intellectual need for Python.
- Tcepsa 6y agoMy favorite language has been Clojure for a long time, but given Python's popularity and widespread use I often wonder whether there is just some big underlying principle that would cause Python's appeal and superiority become clear, if only I could see it. Comments like yours and GP's help reassure me that there's not just some fundamental thing about Python that I'm missing. (And don't even get me started on Python's concurrency situation!)
- Scarbutt 6y agoPython is easy to get started with and has syntax that's nice to look at, easy/nice almost always wins over better. So now the issue is many have to keep using Python because of the ecosystem not because they find the language good.
- cutler 6y agoThe top 3 programming languages - JS, Python & Java - are all pretty uninspiring. It's all about history and ecosystem unfortunately.
- iLemming 6y ago> The top 3 programming languages - JS, Python & Java - are all pretty uninspiring. And Clojure beautifully solves many pain points of Java and Javascript, and even C#. I haven't tried clj-python mentioned, but I hope someday soon, running Clojure code interoperable with Python in production becomes a reality. The hosted nature of the language is a brilliant idea. Clojure eliminates many small annoyances I hate in other languages - syntactical, semantical, and operational. I wish more programmers have given a heartfelt try to Clojure instead of whining that "Lisp is unreadable" and "the parentheses are awful".
- konjin 6y agoPython has been getting worse with time. I learned it in the 00's in highschool and it was a very nice small scripting language that you could just write dumb code which worked and you wrote C for where you needed performance. For some reason people have pushed it everywhere and lost the spark it used to have.