This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients Marco Sulla, steven.daprano
Date 2020-02-01.12:21:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1580559699.75.0.71703233296.issue39516@roundup.psfhosted.org>
In-reply-to
Content
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 the two operators to mean. Unary plus is not necessarily a no-op. For example, the Decimal class gives a meaning to unary plus.

`++` should never be an operator in the future, precisely because it already has a meaning today (either two unary pluses, or binary plus followed by unary plus). Even if the compiler could distinguish between the cases, the human reader would not.

The first expression is not "unreadable". The fact that you were able to read it and diagnose it yourself as a binary operator followed by a unary operator proves that you can, in fact, read it. And it probably wasn't that hard to understand. (It wasn't for me.)

It would be easier to read if you used spaces around the binary plus and no space between the unary plus and its operand, but it can still be read and understood even with the unusual spacing.
History
Date User Action Args
2020-02-01 12:21:39steven.dapranosetrecipients: + steven.daprano, Marco Sulla
2020-02-01 12:21:39steven.dapranosetmessageid: <1580559699.75.0.71703233296.issue39516@roundup.psfhosted.org>
2020-02-01 12:21:39steven.dapranolinkissue39516 messages
2020-02-01 12:21:39steven.dapranocreate