3 ms·
Ask HN: Will I Regret Choosing Python Over Clojure?
Because I've delayed learning a high-level programming language for too long, I have not developed a strong bias toward any in particular. I will code a web app for my current project whose main function will be a search engine for a local index of profiles. From preliminary research, I'm convinced that Lisp or Python are great choices. I've begun learning and will become proficient in both (I've chosen Clojure as the dialect of Lisp). I've found a lot of very good resources to get me started with Python, and therefore I'm leaning more towards Python with Django for my web app.
Some smart hackers evangelize the power of Lisp over other languages. The main advantage, as I understand from my novice perspective, is the ability to create and use macros. Is there anything I should be aware of that may cause me to wish I hadn't chosen Python over Clojure to code the prototype? In my ignorance, I may be asking that you infer too much before answering. If you need more explicit info for my specific situation, then please ask. Thank you very much for your time.
- dilap 12y agoWhat's your low-level prog lang experience? When you say search-engine, do you mean the actual indexing will be written in python, or will you be integrating w/ something else? Finally, is your current project a school project, a hobby project, or a work project?
- scobar 12y agoI learned some cs theory and basic programming with Component Pascal in 2 college semesters. I played around with Basic as a kid, and became familiar with HTML and Javascript by building websites as a hobby for about 12 years. I used the scripting language AutoIt to code programs to automate tasks in the Windows environment. I'm not as familiar with Linux as I should be, but I will dive back into it. Yes, the web app will allow the creation of profiles, and then index those profiles. The search engine will return a ranked list of profiles based on query parameters. I do not know enough yet to understand how much of it I will have to code myself, or if something already exists that I can integrate with. My project is my startup. My income comes from side projects.
- dilap 12y agoIt sounds like you are not in a situation in which taking a technological dead end would be catastrophic, so I would advise following whatever path seems most interesting to you, and not worrying too much if it's the "right" thing. That said, here's my 2¢. I have a background in C++, straight C, Python, and Objective-C, and have dabbled in a bunch of other languages. In Python, I have worked on a backend for real-time routing app (which wrapped a C++ routing core); a frontend (in Qt) for a scheduling application (that embedded a C++ optimizer); and am currently working on a backend for a social app. I have no experience w/ clojure, though it seems very interesting; the most salient feature (from my outside perspective) is its encouragement of programming using immutable datastructures. I have some experience w/ macros from emacs lisp and dabbling in scheme, and I would encourage you to avoid them -- macros are basically an easy way to define a new language, which isn't something you should be doing unless you have a really good idea of why you are doing it. (But other people would disagree w/ this.) As for Python, it's a lovely language, but beware: (1) It's slow. This is something that doesn't matter until suddenly it does; people will just say you should "write the slow bits in C", which I have done, but I would strongly advise against because 1a. Integrating C and python is a pain-in-the-ass; imagine all the normal pain of a compiled language, and multiply it by maybe 3 1b. It's actually a very hard optimization problem to find a computational core that can be called infrequently enough that the overhead from Python->C doesn't kill you. I suspect that for many programs, this cut occurs at "the program essentially written in C". (2) It's dynamically typed; this is an eternal flameware, but I'll just say the longer I've been programming, the more I appreciate having as many compile-time checks as possible. Think of types as an incredibly comprehensive set of tests that were written for you for free. If you do use python, I strongly recommend using something like pyflakes or pylint. I can't speak to clojure. :) I might also consider something like Go -- it's simple, it has a reasonable set of static guarantees, and it performs reasonably quickly. But I've only experimented w/ toy programs so far -- caveat emptor! And good luck :)
- scobar 12y agoYour first point is accurate. I will likely start with Python because that's what I'm most attracted to currently. I want to thank you for taking the time to offer your advice with such a thoroughly written explanation from your POV. I will check out Pyflakes and Pylint. I was already intrigued by Go, so I'll learn and dabble with it for fun programs. I really appreciate your help.
- eshvk 12y agoUse the language that lets you build things fastest. Especially since you keep using the word prototype. Once you prove it is working, you can make it beautiful, use fancy languages or throw money at the problem.
- scobar 12y agoThank you for your response. I intend to use Python because I'm more familiar with object-oriented style, and already have learned more about Python than Clojure. So I assume I'll be able to build things faster with Python. I was asking HN if anyone could see any future problems that were not obvious to me. I understand the project will change and adapt to improve, but I prefer to avoid wasting time converting to fancy languages or throwing money at the problem.
- eshvk 12y agoThere could be several future problems that you could optimize around. Speed, usability of API, NLP aspects of the problem, integrating with off the shelf solutions and so on. It really depends on what you want. If you want to learn a language for the sake of learning it, more power to you. Go forth and pick one of those. Python is fun. I have heard amazing things about Clojure. If you want to ship, just ship! A coworker of mine said something amazing the other day: Whilst an Architect worried about Python vs Scala vs Java, someone shipped in PHP.
- scobar 12y agoIt appears that my perspective is ignorant of too many possible challenges I may face. I just need to build it, and react the best I can when a problem becomes apparent. Thank you for making this clear.
- eshvk 12y agoThat is alright, though. This is the nature of things. For everyone, really.
- brudgers 12y agoClojure is less broadly marketed than Python in the sense that the supporting materials often feel like there is an implicit assumption that the reader has a background in Java or Common Lisp. Python on the other hand is marketed like Basic or maybe Pascal, and there are many many warm fuzzy introductions - they may not be very good but they are very gentle. Which one? Well for scripting, if it's just one or the other Python. For something big and performant, Clojure. For a pure intellectual exercise, Clojure again. For broadening a resume, probably Python.
- scobar 12y agoThank you for your response. From my experience, you're very right about resources to learn Python being very beginner-friendly. I believe I can build the prototype faster in Python, so that's what I'll do. I don't care how my resume may be affected, so that's irrelevant to my decision. The idea of a language that evolves with the project is too tantalizing to ignore. So, I'll learn Clojure by writing fun side-project programs with it. From what I've read, learning both languages well will make me a better programmer anyway.
- brudgers 12y agoFor side projects, have you considered Racket? Like Python there's a beginner friendly ecosystem - it might be argued that it has a better one based on Racket being the product of several decades of research into the problem of teaching programming languages. Being a Lisp, it doesn't have the backwards/forwards compatability issues of Python 2/3 and of course has the Lisp goodness of Clojure [1]. Unlike Python, the community tends to row in the same direction because the active development community is strongly rooted in academia. This also means that just about every software theory gets rolled into the ecosystem as someone's graduate thesis or a professor's publish or perish publication. Yes, I'm a fanboy (but if it's any excuse it's because I'm a Lisp fanboy). Another option for learning FP is Scala and Functional Programming Principles in Scala by Martin Odersky just started on Coursera [Odersky designed Scala]. Like Clojure, Scala runs on the Java Platform, and is designed to address some of the same programming issues. Racket: http://docs.racket-lang.org http://docs.racket-lang.org A long but great presentation on Scala: https://www.youtube.com/watch?v=LH75sJAR0hc https://www.youtube.com/watch?v=LH75sJAR0hc Odersky's Course: https://www.coursera.org/course/progfun https://www.coursera.org/course/progfun [2] [1] And you can tell your friends that you are using the same programming stack as was used by PG for Hacker News even if it's a bit of a stretch it does have some snob appeal. [2] Odersky's course is loosely based on SICP but using Scala.