[Python-ideas] Another way to avoid clumsy lambdas, while adding new functionality

Cameron Simpson cs at zip.com.au
Wed Mar 5 01:06:10 CET 2014


On 04Mar2014 17:57, Ryan Gonzalez <rymg19 at gmail.com> wrote:
> Only problem is that it looks a tad perlish...

Of shellish.

But worse, does nothing even remotely loke what that does in perl
or shell (or basic or...).

I was going to remark that in my mind I would always see:

  a = $foo + 1

and (1) mentally bind the "$" to "foo" alone, not treat it as a
prefix to the whole expression and (2) expect "a" to evaluate right
now, regardess.

And then follow up that remark with a strong preference for forming
the who expression inside a clear construct so you know at the
outself that it is something for evaluation later.

And then realised that is already spelt "lambda".

I do take the point that this "bill" idea is meant to grant access
to the local scope when used.

Cheers,
-- 
Cameron Simpson <cs at zip.com.au>

Take a perfectly parallel uniform plank of constant density. Balance it exactly
at its centre on a frictionnless pivot. Place the hog at a known distance
from this pivot. Now add stones on the other end at exactly the same distance
until the plank is perfectly horizontal as measured by a precision tiltmeter.

Now guess the weight of the stones.
        - Bob Newhart on weighing a hog


More information about the Python-ideas mailing list