mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-13 14:36:58 +07:00
18 lines
1.6 KiB
Plaintext
18 lines
1.6 KiB
Plaintext
<div class="section" id="lambda">
|
|
<span id="lambdas"></span><span id="id13"></span><h2>Lambdas</h2>
|
|
<pre id="index-71">
|
|
<strong id="grammar-token-lambda_expr">lambda_expr </strong> ::= "lambda" [<a class="reference internal" href="compound_stmts.html#grammar-token-parameter_list"><tt class="xref docutils literal"><span class="pre">parameter_list</span></tt></a>]: <a class="reference internal" href="#grammar-token-expression"><tt class="xref docutils literal"><span class="pre">expression</span></tt></a>
|
|
<strong id="grammar-token-lambda_expr_nocond">lambda_expr_nocond</strong> ::= "lambda" [<a class="reference internal" href="compound_stmts.html#grammar-token-parameter_list"><tt class="xref docutils literal"><span class="pre">parameter_list</span></tt></a>]: <a class="reference internal" href="#grammar-token-expression_nocond"><tt class="xref docutils literal"><span class="pre">expression_nocond</span></tt></a>
|
|
</pre>
|
|
<p>Lambda expressions (sometimes called lambda forms) are used to create anonymous
|
|
functions. The expression <tt class="docutils literal"><span class="pre">lambda</span> <span class="pre">arguments:</span> <span class="pre">expression</span></tt> yields a function
|
|
object. The unnamed object behaves like a function object defined with</p>
|
|
<div class="highlight-python3"><div class="highlight"><pre>def <lambda>(arguments):
|
|
return expression
|
|
</pre></div>
|
|
</div>
|
|
<p>See section <a class="reference internal" href="compound_stmts.html#function"><em>Function definitions</em></a> for the syntax of parameter lists. Note that
|
|
functions created with lambda expressions cannot contain statements or
|
|
annotations.</p>
|
|
</div>
|