Steven D'Aprano <steve+pyt...@pearwood.info> 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 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.

----------
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39516>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to