[Tutor] Assistance

Wayne Werner waynejwerner at gmail.com
Mon Apr 25 20:19:35 CEST 2011


On Mon, Apr 25, 2011 at 1:13 PM, Prasad, Ramit <ramit.prasad at jpmchase.com>wrote:

> b = + 2 is legal syntax, while b + = 2 is not.
>
> Why do you 'b += 2' is not legal syntax? It seems to work in python 2.x and
> 3.x. Is this deprecated or looked down upon? Is it better to use 'b = b + 2'
> ?
>
> For the +2, it did not even occur to me that it was referring to a positive
> number and not some kind of addition/concatenation. Whoops!


b +space= 2, where there is a space between + and =

+= is perfectly legal, and (I would argue) the better choice.

-Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110425/c4311274/attachment.html>


More information about the Tutor mailing list