[Tutor] multiple assignment on one line

bob gailer bgailer at gmail.com
Sun Nov 22 21:02:00 CET 2009


Shashwat Anand wrote:
> Ok, this is silly but i want to know is multiple assignment is 
> possible in one line using "+=, -=, *= etc" operators on python 2.6.4

Read the manual: 6.3.1 Augmented assignment statements

"target augop expression_list
An augmented assignment evaluates the target (which, unlike normal 
assignment statements, cannot be an unpacking) and the expression list, 
performs the binary operation specific to the type of assignment on the 
two operands, and assigns the result to the original target."

-- 
Bob Gailer
Chapel Hill NC
919-636-4239


More information about the Tutor mailing list