Lisp mentality vs. Python mentality

Dan Sommers somm1105 at bellsouth.net
Mon Apr 27 22:26:08 EDT 2009


On Mon, 27 Apr 2009 07:57:00 +0300, Ciprian Dorin, Craciun wrote:

> On Mon, Apr 27, 2009 at 2:14 AM, Dan Sommers <somm1105 at bellsouth.net>
> wrote:

>> Also from the Zen:  flat is better than nested.  One of the aspects of
>> flatter call trees and object hierarchies is that I hit the bottom
>> (language features or the standard library) sooner, and I "should"
>> already have the language and its standard library in my brain.  That
>> said, I also tend to break my programs into layers, but I do try to
>> make each layer as thin as possible (but no thinner).
> 
>     I agree with your opinion about keeping the abstraction layers
> shallow, but in my view high-order and helper functions do not comprise
> a new abstraction layer. For example in Lisp, using map, reduce (fold),
> or any other high-order function is just like using for, or while in a
> normal imperative language.

If I hit a call to map or to reduce, I've hit the bottom:  map and reduce 
are defined by Lisp and not by the programmer.

>     And also I would like to point out that "hitting the language
> sooner", means to know every function in the standard Python library
> (which is by far uncomprehensible, its huge) and most of the times you
> also need the documentation. And if we go this path, when debugging we
> could use a smart IDE, which should show as tool-tip-text for function
> names their documentation, and in this way all we have to do to
> understand a particular function is just to point it out.

Although huge, at least the standard Python library is *bounded* (even if 
only within a given release).  The more I use it, the better I know it, 
and there's probably an 80/20 rule in there somewhere (if I concentrate 
on programs in my particular area(s) of interest, there may even be a 
lurking 90/10 rule).  Maybe I don't know the Standard Patterns well 
enough (I still speak OO as a second language), but even when I see 
something as apparently clear as add_listener(f), I have to wonder about 
the specific semantics of your particular add_listener function.




More information about the Python-list mailing list