[issue39516] ++ does not throw a SyntaxError

2020-02-04 Thread Marco Sulla
Marco Sulla added the comment: > this is the sort of thing that is usually best suited to be reported by > linters, not the Python runtime. TL;DR: if you write something like `a -- b`, it's quite extraordinary that you really wanted to write this. You probably wanted to write `a - -b` or, mo

[issue39516] ++ does not throw a SyntaxError

2020-02-04 Thread Eric Snow
Eric Snow added the comment: FWIW, this is the sort of thing that is usually best suited to be reported by linters, not the Python runtime. -- nosy: +eric.snow ___ Python tracker ___

[issue39516] ++ does not throw a SyntaxError

2020-02-01 Thread Marco Sulla
Marco Sulla added the comment: > `++` isn't special Indeed the problem is that no error or warning is raised if two operators are consecutive, without a space between. All the cases you listed are terribly unreadable and hardly intelligible. Anyway I do not agree `++` is not special: > yo

[issue39516] ++ does not throw a SyntaxError

2020-02-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: Marco, this is no more of a defect than `x*-y` or `a&~b`. It is a binary operator followed by an unary operator, just like `x--y`, `x/-y`, `x+-y`, `x**-y` etc. Python has at least three unary operators and at least 17 binary operators so in total there are

[issue39516] ++ does not throw a SyntaxError

2020-02-01 Thread Marco Sulla
Marco Sulla added the comment: > This is not a bug No one said it's a bug. It's a defect. > This has been part of Python since version 1 There are many things that was part of Python 1 that was removed. > `++` should never be an operator in the future, precisely because it already > has a me

[issue39516] ++ does not throw a SyntaxError

2020-02-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug, as you have pointed out yourself you are using a binary plus and a unary plus operator in the same expression. This has been part of Python since version 1, and with operator overloading `obj + +thing` could mean whatever the objects want

[issue39516] ++ does not throw a SyntaxError

2020-02-01 Thread Marco Sulla
New submission from Marco Sulla : Python 3.9.0a0 (heads/master-dirty:d8ca2354ed, Oct 30 2019, 20:25:01) [GCC 9.2.1 20190909] on linux Type "help", "copyright", "credits" or "license" for more information. >>> 1 ++ 2 3 This is probably because the interpreter reads: 1 + +2 1. ++ could be an o