While we're on the subject of proposing language changes... ;-)
Dan Bishop
danb_83 at yahoo.com
Fri Feb 14 20:35:00 EST 2003
PEP: XXX
Title: Combined function call/assignment operator
Author: Dan Bishop
Created: 2003-02-14
INTRODUCTION
Augmented assignment operators were added to the Python language in version
2.0 to simplify common constructs like x = x + 1. This PEP proposes extending
the augmented assignment syntax to assignment-and-function call statements.
The current augmented assignment syntax, although very convenient, adds an
inconsistency to the Python language. While statements like "x = x + 1"
can be rewritten using an abbreviated syntax, the semantically equivalent
"x = operator.add(x, 1)" cannot. This PEP will restore consistency to the
language while at the same time introducing a convenient syntax for the
frequently-used x = f(x, ...) constructs.
SYNTAX
The proposed syntax mirrors the syntax of augmented assignments
x foo= y, z <==> x = foo(x, y, z)
In the case of one-argument functions, the right hand side of the assignment
is empty.
x abs= <==> x = abs(x)
More information about the Python-list
mailing list