Re: [RFC] Draft Proposal for New Python Syntax

Guido.van.Rossum@cwi.nl
Fri, 27 May 1994 10:09:13 +0200

> 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
definitions. Everything you can do with lambda you could always do
with local functions, at the cost of one local temporary identifier --
surely no big deal!

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.

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).

To be honest, I wish I hadn't introduced lambda, map, filter and
reduce -- they support a style that is inconsistent with the rest of
Python. Unfortunately, in the sake of backward compatibility, I can't
take them out. So enjoy them if you have to. But don't get too
thrilled!

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
URL: <http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>