Lambda in Python…

May 9, 2007 § 2 Comments

Is like watching trailer of a movie. Exciting, but not quite the real thing.

Why get so excited about it? It’s just an anonymous function. A nameless function that could be created on run-time. Doing just about everything you wish.

No, It doesn’t do just about everything, GVR would have been so mad if it does. Below are limitations of lambda in Python:

  • Only takes 1 expression.
  • Cannot takes statements.

But that doesn’t stop lambda from being cool. It can:

  • perform pretty funky math expression inside your defined functions.
  • perform built-in python functions, e.g. all sorts of string manipulation. Imagine pulling out large “string” data that doesn’t look quite right on your web form.

No, I’m not bashing Lambda. Nor that I wish for it to be more powerful. There’s exact need for lambda in Python. It cannot be abused by people too lazy to press “return” or “def” but it can modify things quickly anywhere.

I am glad that lambda doesn’t try to be the “real” functional languages such as Scheme because that would seriously bastardized readability.

References:

Python: Lambda Functions

[Tutor] Why Lambda could be considered evil

Book: An Introduction to Python

About these ads

§ 2 Responses to Lambda in Python…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading Lambda in Python… at RAPD.

meta

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: