3 ms·
I mostly agree with tdrgabi, and I think Python has a big advantage over the Lisps I've used (Common Lisp and Racket) in its "batteries included" standard libra
by dkarl 16y ago
I mostly agree with tdrgabi, and I think Python has a big advantage over the Lisps I've used (Common Lisp and Racket) in its "batteries included" standard library. Plus, Python is more readable and has powerful list comprehensions that make it competitive with Lisp in expressiveness in most cases. And, of course, the biggest advantage of Python or Ruby over Lisp is political -- if you hand off a well-written Python script to your coworker and he complains about you using Python, then he looks like an idiot instead of you. Try that with Lisp.
However, I think Common Lisp and Racket have two big advantages over Python. Number one is performance. They're dynamic, but they're also compiled, which means they can be big and featureful when that's what you want (e.g., CLOS) but they can be fast when you need them to be. I haven't tried this in Racket yet, but when you're optimizing a function in Common Lisp, you can ask the REPL for the compiled form and it will spit out the assembly. You can tweak the safety and optimization settings, recompile the function, and look at the assembly again. Iterate until you eliminate whatever is killing your performance. Python lets you call out to C, of course, but so do Common Lisp and Racket.
Number two is the development experience. The typical workflow is to set up a running instance of Lisp, connect to it from your editor, and then send code to it. You can write a bunch of code in your editor, highlight a couple of functions and send them to your Lisp instance, and then play with those functions in the REPL. Need to tweak something or fix a bug? Edit a function and send the new version to the Lisp instance. Then see how it works. Maybe you can do the same thing in Python with the correct setup. If so, I'd love to hear it. (I'm sure it's possible with some Python IDE or other, but why give up your favorite text editor?)
Number three, if it came into play more often, would be that Lisp really is more expressive than Python. Honestly, I almost never see the difference in the work I do for a living. The more interesting the problem, though, the more likely you are to see a difference.
- mark_l_watson 16y agoYou have it exactly right, I think: Lisp's advantage is the interactive repl environment. I do a lot of work with NLP and keeping a (SBLC) Lisp image with all required data loaded saves a lot of time. Even if I am not working in the mode of keeping pre-built images around, starting up an environment and not having to restart it saves a lot of time. I really love to code in Ruby, but the repl experience is better in Lisp.
- agentultra 16y agofwiw, Racket is byte-compiled and run on a VM with a JIT compiler for optimization. Depending on the implementation, you can get machine-code from Lisp by way of an optimizing compiler or you can get just the interpreter. There is a lot that Common Lisp has that is heads above Python in terms of features (CLOS, numerics, streams, macros). The implementations can offer even more (threading, optimized machine code, GUIs, etc). Racket offers its own features and benefits. It has a great built in library, you can package languages as libraries, it has a great module system and public repository... Python, Lisp, Ruby... they all have their features and trade offs. Maybe you can do the same thing in Python with the correct setup. You can with Emacs, pdb, iPython, virtualenvwrapper, and a few emacs-lisp scripts. It's nothing compared to CL+Slime, but it's pretty good. I use it in my day to day work.