Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6930777

Browse files
committed
merge with 3.3
2 parents ce28e2c + 242e6a0 commit 6930777

4 files changed

Lines changed: 18 additions & 17 deletions

File tree

Doc/faq/design.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -347,20 +347,20 @@ Answer 2: Fortunately, there is `Stackless Python <http://www.stackless.com>`_,
347347
which has a completely redesigned interpreter loop that avoids the C stack.
348348

349349

350-
Why can't lambda forms contain statements?
351-
------------------------------------------
350+
Why can't lambda expressions contain statements?
351+
------------------------------------------------
352352

353-
Python lambda forms cannot contain statements because Python's syntactic
353+
Python lambda expressions cannot contain statements because Python's syntactic
354354
framework can't handle statements nested inside expressions. However, in
355355
Python, this is not a serious problem. Unlike lambda forms in other languages,
356356
where they add functionality, Python lambdas are only a shorthand notation if
357357
you're too lazy to define a function.
358358

359359
Functions are already first class objects in Python, and can be declared in a
360-
local scope. Therefore the only advantage of using a lambda form instead of a
360+
local scope. Therefore the only advantage of using a lambda instead of a
361361
locally-defined function is that you don't need to invent a name for the
362362
function -- but that's just a local variable to which the function object (which
363-
is exactly the same type of object that a lambda form yields) is assigned!
363+
is exactly the same type of object that a lambda expression yields) is assigned!
364364

365365

366366
Can Python be compiled to machine code, C or some other language?

Doc/reference/compound_stmts.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -536,17 +536,17 @@ function. The annotation values are available as values of a dictionary keyed
536536
by the parameters' names in the :attr:`__annotations__` attribute of the
537537
function object.
538538

539-
.. index:: pair: lambda; form
539+
.. index:: pair: lambda; expression
540540

541541
It is also possible to create anonymous functions (functions not bound to a
542-
name), for immediate use in expressions. This uses lambda forms, described in
543-
section :ref:`lambda`. Note that the lambda form is merely a shorthand for a
542+
name), for immediate use in expressions. This uses lambda expressions, described in
543+
section :ref:`lambda`. Note that the lambda expression is merely a shorthand for a
544544
simplified function definition; a function defined in a ":keyword:`def`"
545545
statement can be passed around or assigned to another name just like a function
546-
defined by a lambda form. The ":keyword:`def`" form is actually more powerful
546+
defined by a lambda expression. The ":keyword:`def`" form is actually more powerful
547547
since it allows the execution of multiple statements and annotations.
548548

549-
**Programmer's note:** Functions are first-class objects. A "``def``" form
549+
**Programmer's note:** Functions are first-class objects. A "``def``" statement
550550
executed inside a function definition defines a local function that can be
551551
returned or passed around. Free variables used in the nested function can
552552
access the local variables of the function containing the def. See section

Doc/reference/expressions.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,8 +1218,8 @@ Conditional expressions
12181218

12191219
.. productionlist::
12201220
conditional_expression: `or_test` ["if" `or_test` "else" `expression`]
1221-
expression: `conditional_expression` | `lambda_form`
1222-
expression_nocond: `or_test` | `lambda_form_nocond`
1221+
expression: `conditional_expression` | `lambda_expr`
1222+
expression_nocond: `or_test` | `lambda_expr_nocond`
12231223

12241224
Conditional expressions (sometimes called a "ternary operator") have the lowest
12251225
priority of all Python operations.
@@ -1243,10 +1243,10 @@ Lambdas
12431243
pair: anonymous; function
12441244

12451245
.. productionlist::
1246-
lambda_form: "lambda" [`parameter_list`]: `expression`
1247-
lambda_form_nocond: "lambda" [`parameter_list`]: `expression_nocond`
1246+
lambda_expr: "lambda" [`parameter_list`]: `expression`
1247+
lambda_expr_nocond: "lambda" [`parameter_list`]: `expression_nocond`
12481248

1249-
Lambda forms (lambda expressions) have the same syntactic position as
1249+
Lambda expressions (sometimes called lambda forms) have the same syntactic position as
12501250
expressions. They are a shorthand to create anonymous functions; the expression
12511251
``lambda arguments: expression`` yields a function object. The unnamed object
12521252
behaves like a function object defined with ::
@@ -1255,7 +1255,8 @@ behaves like a function object defined with ::
12551255
return expression
12561256

12571257
See section :ref:`function` for the syntax of parameter lists. Note that
1258-
functions created with lambda forms cannot contain statements or annotations.
1258+
functions created with lambda expressions cannot contain statements or
1259+
annotations.
12591260

12601261

12611262
.. _exprlists:

Doc/tutorial/controlflow.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ Lambda Expressions
588588

589589
Small anonymous functions can be created with the :keyword:`lambda` keyword.
590590
This function returns the sum of its two arguments: ``lambda a, b: a+b``.
591-
Lambda forms can be used wherever function objects are required. They are
591+
Lambda functions can be used wherever function objects are required. They are
592592
syntactically restricted to a single expression. Semantically, they are just
593593
syntactic sugar for a normal function definition. Like nested function
594594
definitions, lambda functions can reference variables from the containing

0 commit comments

Comments
 (0)