Re: [RFC] Draft Proposal for New Python Syntax

Kenneth Manheimer (klm@nist.gov)
Fri, 27 May 1994 20:43:54 GMT

Guido.van.Rossum@cwi.nl writes:

> > Actually, the fact that it has anonymous lambdas, and now a
> > substantial contingent of map functions, is thrilling. (Isn't that
> > sick?-) Imagine, python functions are real first class objects, in a
> > *scripting* language! Too cool. All that, plus *lexical scoping*,
> > and a simple object system!
>
> Ah, the infamous "first class objects" argument again. Really, I
> don't understand all the fuzz about lambda, and I don't see why its
> introduction made functions any more first class than they already
> were in Python. They are entirely syntactic sugar for local function

I was cooing over the existence of lambdas as well as the fact that
functions are first class objects, not that one caused the other.
Though i guess it would seem that way from that paragraph. (I usually
don't gush over a new computer language, btw. I've done a lot of
shell, nawk, and (emacs and, some, more sophisticated) lisp coding,
and was hopeful about but disappointed by the different prospects of
tcl and perl. Python looks to be a really surprisingly good fit for
my purposes.)

> Also notice that Python's map, filter and reduce are quite powerless
> compared to the same functions in the average functional programming
> system -- they don't work when applied to infinite sequences since
> they use eager evaluation.

I'd expect to be able to express some things much more concisely and
clearly using mapping than by using loops. In some cases, the
performance loss is not of concern, and is well worth the clarity.

> Steven Majewski might not agree with me, but in Python you are better
> off using "for" loops (the overhead of calling a function for each
> element is quite substantial).

Due to stack pushes and pops? Or is a dictionary established for the
parameters each time a function is invoked? Or is it something else?
(This is useful practical information.)

Ken