[Python-ideas] a new lambda syntax

Nick Coghlan ncoghlan at gmail.com
Tue Oct 20 13:04:13 CEST 2009

Stephen J. Turnbull wrote:
> Nick Coghlan writes:
>  > For myself, I don't actually agree it's a valid design rule - I think
>  > anonymous blocks have legitimate use cases (see Ars Technica's writeup
>  > of the Apple's new Grand Central Dispatch and C-level anonymous block
>  > system in OS X 10.6).
> That doesn't look like what "anonymous block" means to me.  It looks
> like a lambda.

The difference lies in the fact that in C, object references are
non-local by default - you have to declare them explicitly in the
current scope to make them local.

Hence the code you stick inline in Apple's new C extensions can
manipulate locals as if it were just a normal part of the current function.

Accordingly, I find the idea of a new function-like construct where all
non-argument variable references are nonlocal by default to be a
potentially interesting one.

It has nothing to do with Python's inherent syntax problems with nesting
statements inside expressions though, which is the reason I snipped that
digression from my previous message.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list