[Python-ideas] Reverse assignment operators (=+, =-, =*, =/, =//, =**, =%)
Guido van Rossum
guido at python.org
Sat Nov 12 16:32:48 EST 2016
- Previous message (by thread): [Python-ideas] Reverse assignment operators (=+, =-, =*, =/, =//, =**, =%)
- Next message (by thread): [Python-ideas] Reverse assignment operators (=+, =-, =*, =/, =//, =**, =%)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
I think a stronger argument to reject this (even for Python 4, and even if
we could somehow get over the syntactic ambiguity) is that it's confusing.
`+=` and `=+` are just visually too close, and the distinction is not all
that intuitive. At least for `a += b` the expansion to `a = a + b` is a
simple contraction. But for the proposed `a =+ b` the expansion would be a
transposition: `a = b + a`. Given the uncommon use case this just isn't
worth the potential confusion.
(Also, there are other possible meanings one could guess for `a =+ b`,
given the meaning of `a += b`. E.g., because it's the exact mirror image,
you could guess that it means `b = a + b`.)
On Sat, Nov 12, 2016 at 12:23 PM, João Matos <jcrmatos at gmail.com> wrote:
> Hello,
>
> I understand that, but in my view a =- c and a = -c should not be same.
> Maybe an ideia for Python 4.
>
> Best regards,
>
> JM
>
>
> On 12-11-2016 20:19, Bernardo Sulzbach wrote:
>
>> On 2016-11-12 18:08, João Matos wrote:
>>
>>> a =- c is the same as a = c - a
>>>
>>
>> This would break compatibility.
>>
>> a =- c
>>
>> is
>>
>> a = -c
>>
>>
>>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
--
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20161112/5928ef5a/attachment.html>
- Previous message (by thread): [Python-ideas] Reverse assignment operators (=+, =-, =*, =/, =//, =**, =%)
- Next message (by thread): [Python-ideas] Reverse assignment operators (=+, =-, =*, =/, =//, =**, =%)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Python-ideas
mailing list