Draft Pep (was: Re: Let's Talk About Lambda Functions!)

François Pinard pinard at iro.umontreal.ca
Mon Aug 5 17:07:12 CEST 2002

[Steve Holden]

> > > 1) Python should have a procedure builder which does not assign the
> > > procedure to a name, because procedure in Python are first-class
> > > values and do not have intrinsic names.
> >
> > The `def' name is not intrinsic.  We all know it is a mere binding.

> But you need to remember that the name bound to the function in the def
> statement is, in some small way, special:

> >>> def myfunc(x):
> ...     pass
> ...
> >>> myfunc
> <function myfunc at 0x100fd438>
> >>> a = myfunc
> >>> myfunc = None
> >>> a
> <function myfunc at 0x100fd438>

OK.  I easily yield that `def' is a bit more than a mere binding, in that
there are useful debugging or introspection capabilities associated with the
function it defines.  I confess never having directly used, in a program,
the capability of accessing a function's canonical name.

> > > 4) Lack of a full lambda prevents Python from being a really good
> > > teaching language.  [...]
> >
> > This is an exaggerated repetition of the second point.  If it was really
> > the case, I would be much tempted to doubt of the teachers, here! :-)

> I agree that there is absolutely *no* need to have lambda at all, let alone
> "full" lambda, to be a good teaching language.

Oh, I might have not expressed myself clearly, sorry!  This was not related
to `lambda'.  Teachers should be fluently able to explain and demonstrate
to students that Python functions are first class objects, using Python as
it currently stands.  If Python is said to not be "a really good teaching
language" because students remain confused about the first class quality
of Python functions, I would doubt the teachers, not the language.

François Pinard   http://www.iro.umontreal.ca/~pinard

More information about the Python-list mailing list