Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

how is python like lisp?


The future we were promised when we bought into what lisp would/could be, with all the practicality we see now in python. Norvig wrote about it more here: http://www.norvig.com/python-lisp.html It was from that article when I gave python a serious try and it stuck with me as a go to language for all the small things one does often, but also exploratory programming as well (with iPython/jupyter).


have you ever tried f#? if you think python is what lisp could be (a little confused by that...see racket...but...), then i am curious what you think about something like f#. it’s like python in a way, in that it has oop and uses indentation and not brackets, but it is so much more. and it’s more regular in its semantics. everything returns a value.


"The future we were promised" sounds like he's talking more about a combination of ergonomics and productivity that were promised by Lisp but it never got there because the community just didn't expand to the same size. Python is so widely used that the combination of adoption and design decisions is in the sweet spot we were "promised" by Lisp advocates.

F# could also play that role since it can access the rest of the .Net ecosystem but for Python is more approachable as an OOP-ish language.


You're exactly right about what I've meant. It's not only about the language. In fact, I'd argue it has the least weight of all of the variables. There are various nice languages (to use) which just aren't there regarding publicly available knowledge, libraries, tools, manpower, etc. (lisp', scheme, d1, Ada even...). Python, while not perfect, sits quite comfortably where you could say it has it all.


you can program f# fully as an oop language, where i think it is still more approachable than python for that. add in async, first class events, tasks, observables, etc., and you have a very approachable but high ceiling with f#. and the syntax is still cleaner than python.


If you like F# but wish you could leverage the Python ecosystem, then try http://coconut-lang.org


It's lisp without the curse. You have an arbitrarily dynamic runtime but enough structure and cultural idiom against abusing it that it has flourished. Compare for example type annotations in python versus those in clojure - clojure's expressivity and the culture's tendency to use it pervasively make meaningful annotations much more difficult than in python, even with python's crazy calling convention. Additionally a lot of my data processing python code winds up feeling very lispy - arbitrarily deeply nested iterator pipelines transforming dumb and often immutable data. We largely do this in python because smart objects are slow not out of any pursuit of purity, we have a thriving ecosystem of these kinds of libraries, but the end result feels vaguely similar either way.


Python is nothing like Lisp, please stop with the generalizations. When it comes to stupid comparisons, Ruby is more Lisp than Python, at least it's got Symbols.

Python is not homoiconic, it doesn't have {reader/compiler/normal}macros, it doesn't have symbols, it doesn't have proper lexical scope, it doesn't have dynamic scope, it doesn't have conditions and restarts, not every statement is an expression, it's full of special cases and is monstrously complicated if you look beneath the surface [thus all the hacks in PEP form].

How is it Lisp when it doesn't have the special magic that makes Lisp so powerful?


Python is an object-oriented BASIC.


'Basically, Python can be seen as a dialect of Lisp with "traditional" syntax'

-- To quote Peter Norvig, Director of Research at Google and author of multiple books on AI and Lisp.


norvig is the only one anyone ever quotes for python vs lisp. he is beyond my knowledge, but i just cannot see what he says in this quote. python doesn’t feel like lisp at all when programming in it. the mindset is completely different.

edit: i thought this quote was much more recent. it was from around when he first joined google or even before.


That wasn't his motivation for using Python.

His motivation was much like many others -- it's the language that looks closer to pseudocode than any other.

His first attempt at doing the AI book using Java was a failure because it's verbosity and lack of features. Students found the Python version much easier to comprehend than the Lisp one.


> His first attempt at doing the AI book using Java was a failure because it's verbosity and lack of features. Students found the Python version much easier to comprehend than the Lisp one.

Sigh. Is that the nature of the beast in lisp? To me, it has always been a difficult language to sell to more "traditional" minded devs.


See Hy - a lisp written in Python (http://hylang.org).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: