Content deleted Content added
Added examples for python & PHP |
→Python: Explain a bit more about its limitations |
||
Line 7:
===Python===
Python supports anonymous functions through the lambda form. It is, however, expected to be only a single line of code and always returns whatever that line returns. For example:
<source lang="python">
foo = lambda x: x*x
print foo(10)
</source>
The lambda function ''always'' returns x*x and there is no way for a lambda function to not return something. This makes anonymous functions limited and are not simply nameless functions.
===PHP===
|