Bitten by my C/Java experience

Chris Angelico rosuav at gmail.com
Wed May 6 09:16:48 EDT 2015


On Wed, May 6, 2015 at 11:11 PM,  <random832 at fastmail.us> wrote:
> On Mon, May 4, 2015, at 18:02, BartC wrote:
>> (I think I would have picked up "++" and "--" as special tokens even if
>> increment/decrement ops weren't supported. Just because they would
>> likely cause errors through misunderstanding.)
>
> There's precedent for not doing this in C itself - even though "=+"
> (from very early versions of C, also =-, =*, =&) no longer acts as an
> add-in-place operator, it's not recognized as a special token to prevent
> errors either.

Given that the in-place operators changed to +=, -=, etc very early
on, I doubt there's anyone who is actually confused by them. And it'd
be extremely annoying to have to stop and think about parsing rules
when taking or dereferencing pointers:

/* This works */
x = &y;

/* Why shouldn't this? */
x=&y;

To the greatest extent possible, spaces around assignment operators
should be the domain of style guides, not syntax.

ChrisA



More information about the Python-list mailing list