Why functional Python matters

Alexander Schmolck a.schmolck at gmx.net
Wed Apr 16 03:19:38 CEST 2003


Dave Benjamin <ramen at lackingtalent.com> writes:

> In article <yfs7k9vcu2p.fsf at black132.ex.ac.uk>, Alexander Schmolck wrote:
> > I think your life might be much happier if you just went to
> > http://www.drscheme.org/, dowloaded Dr Scheme and used *that* for
> > webdevelopment. Then you can use a real functional programming language and
> > read books by people who actually have a real clue about functional
> > programming (there is lots of *excellent* material available on-line and for
> > free, like SICP and HTDP, the latter uses Dr Scheme -- also have a look at
> > http://www.cs.brown.edu/courses/cs173/2001/Lectures/). Why settle for some
> > second-rate immitation? [1]
> 
> I may just take your advice and investigate that. Thanks for the reference.
> But keep in mind that I'm not saying "I don't like Python, it's not
> functional enough". I'm saying "I love Python, it lets me work in both an FP
> and OOP style, and this makes me happy. I just don't want to see FP support
> drop out of the picture."

Well it seems to me that you're currently *really* keen on functional
programming. You can do that (and learn about it) much better in scheme than
in python, so even if you want to program in python for the rest of your life
afterwards it might well be worth it. I mean you wouldn't want to learn OO in
C, would you -- there a fewer good ressources and it's just much more of a
pain (this comparison is of course overly pessimistic -- C is just horrible
and python really isn't).

Plus, Dr Scheme is a rather nice learning environment, has plenty of cool
stuff (and quite a few libraries) and let's you do OO, too (if you use Emacs
check out quack.el, BTW).


> That's true, but then I have to name "bar". And part of the joy of FP is not
> having to name *everything*. Naming things is important if you need to call
> them up later, but it's a hassle to name intermediate values

No argument here. I tend to think python would have been a better language if
it had included something like smalltalk-like blocks from day 1 (I still
really like python).

> >> keyword-argument trick wasn't really that bad, once you got used to it. In
> >> any case, with dynamic scoping, this problem has completely disappeared.
> >                  ^^^^^^^^^^^^^^^
> > not quite.
> 
> Am I using the wrong terminology here? I'm specifically talking about the
> named-argument hack to get around Python's previous lack of nested scopes.
> This specific problem, as far as I know, is gone now. Am I missing something?

Yes but certainly not due to dynamic scoping (which python doesn't even have,
as you can see from the raging Emacs thread). It now has non-crippled lexical
scope :)

(have a look at http://www.supelec.fr/docs/cltl/clm/node43.html for a good
explanation)

> Well, I don't think people usually write functions for list comprehensions
> at all.

Never mind, I just shouldn't write postings when I'm tired (like now:).

'as




More information about the Python-list mailing list