diff --git a/pep-0572.rst b/pep-0572.rst index 1c462308a..73764c920 100644 --- a/pep-0572.rst +++ b/pep-0572.rst @@ -297,7 +297,18 @@ Broadly the same semantics as the current proposal, but spelled differently. ``with`` and ``except`` statements, where a nearly-identical syntax has different semantics). -2. Adorning statement-local names with a leading dot:: +2. ``EXPR -> NAME``:: + + stuff = [[f(x) -> y, x/y] for x in range(5)] + + This syntax is inspired by languages such as R and Haskell, and some + programmable calculators. (Note that a left-facing arrow ``y <- f(x)`` is + not possible in Python, as it would be interpreted as less-than and unary + minus.) This syntax has a slight advantage over 'as' in that it does not + conflict with ``with`` and ``except`` statements, but otherwise is + equivalent. + +3. Adorning statement-local names with a leading dot:: stuff = [[(f(x) as .y), x/.y] for x in range(5)] # with "as" stuff = [[(.y := f(x)), x/.y] for x in range(5)] # with ":=" @@ -309,7 +320,7 @@ Broadly the same semantics as the current proposal, but spelled differently. become the current recommendation if its advantages are found to outweigh its cost. -3. Adding a ``where:`` to any statement to create local name bindings:: +4. Adding a ``where:`` to any statement to create local name bindings:: value = x**2 + 2*x where: x = spam(1, 4, 7, q)