Python/scripts

From Christoph's Personal Wiki
Revision as of 23:13, 10 March 2009 by Christoph (Talk | contribs) (New page: This article will list a bunch of quick-and-dirty Python tips-and-tricks, examples, code, etc. ==Lambda functions== In stead of creating a new function of f(x): return x + 1 You coul...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This article will list a bunch of quick-and-dirty Python tips-and-tricks, examples, code, etc.

Lambda functions

In stead of creating a new function of

f(x): return x + 1

You could use a lambda function inline, like so:

function_var = lambda x: x + 1
>>> print function_var(2)
3