On 2013-02-08, at 16:39 , Chris Withers wrote:

> Hi All,
> 
> Just had a bit of an embarrassing incident in some code where I did:
> 
> sometotal =+ somevalue
> 
> I'm curious why this syntax is allowed? I'm sure there are good reasons, but 
> thought I'd askā€¦

sometotal = (expression) is valid syntax, and +value is valid syntax.

Thus what you wrote is perfectly normal syntax, it's the assignment of a
pos'd value, badly formatted. pep8.py will warn against it (it'll
complain that the whitespace around `+` is wonky). But I see no
justification for disallowing this, anymore than for disallowing the
rougly equivalent (and just as error-prone) `sometotal = -somevalue`.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to