Extending Python Syntax with @

John Roth newsgroups at jhrothjr.com
Thu Mar 11 17:17:08 CET 2004


"David MacQuigg" <dmq at gain.com> wrote in message
news:mu2150t5ppk9f0n89uhkijtce2htsga2dg at 4ax.com...
> On Thu, 11 Mar 2004 12:55:20 -0000, claird at lairds.com (Cameron Laird)
> wrote:
>
> >In article <2f9050pq22u53o7aqo9i8ebqj11vo9kilg at 4ax.com>,
> >David MacQuigg  <dmq at gain.com> wrote:
> > .
> > .
> > .
> >>going to help me write some code, I won't have time to study it.  My
> >>understanding of lambda functions is simply that they are a way to
> >>squeeze functions into a tight space:
> >>
> >>list_of_funcs = [(lambda x: 2**x), (lambda x: 3**x), (lambda x: 4**x)]
> >>
> >>If you are not concerned about space, simply use normal defs:
> >>
> >>def f2(x): return 2**x
> >>def f3(x): return 3**x
> >>def f4(x): return 4**x
> >>list_of_funcs = [f2, f3, f4]
> >>
> >>Is there any other reason in Python to use lambdas?
> > .
> > .
> > .
> >In fact, *that*'s not a reason.  Part of tribal lore--a true,
> >documented part, by the way--is that Big Cheese Guido depre-
> >cates lambdas.  He says they're a mistake, and people shouldn't
>
> Wow!!  And I thought it was just me.  Could you point me to a PEP or
> other discussion?  I would sure like to know the history of this.
> Could it be that in adding "lambda calculus" to Python, Guido was
> snowed by the language theorists? <half wink>

There's a presentation on the Python site - go to Doc, then to
Guido's Essay's, then to Presentations. It's called Python Regrets.
Google has an HTML version if you use "Python Regrets Guido"
as the keywords.

The lambda keyword really has almost nothing to do with the
lambda calculus: it's about a number of functional extensions
that are all being phased out over a period of time.


> I think it is really cool that a language can actually have a mistake
> like this corrected.  In the commercial world I'm used to, such a
> feature would become part of the core religion, and any questioning
> would eventually be met with "There are just some things you can't
> understand.  Get back to work!"

There are a few too many of these in Python as well. It's going
to be a long time for the language to evolve, especially since
there seems to be a religious cult that is holding on to release
1.5.2 like it will insure their salvation.

John Roth

>





More information about the Python-list mailing list