On Sun, Nov 13, 2016 at 4:00 PM, Mikhail V <mikhail...@gmail.com> wrote:
> On 12 November 2016 at 21:08, João Matos <jcrma...@gmail.com> wrote: > > > What I would like to propose is the creation of the reverse: > > a =+ c is the same as a = c + a > > a =- c is the same as a = c - a > > a =* c is the same as a = c * a > > a =/ c is the same as a = c / a > > a =// c is the same as a = c // a > > a =% c is the same as a = c % a > > a =** c is the same as a = c ** a > > A good syntax example: > > a = sum (a, c) > a = mul (a, c) > a = div (a, c) > Except that there is no "div" in python 3.x, and "sum(a, c)" does not add "a" and "c". > Another good syntax, I'm not a fan of, but at least intuitive and > learnt in school: > > a = a + c > a = a * c > a = a / c > How is using a function better than using an operator? Especially considering the ambiguity issues you just demonstrated. The fact the operator version is part of the core language while the function versions aren't even builtins (they are in the "operator" module) suggests to me that the function version is not the preferred version in Python. > Bad syntax, not readable: > > a += c > a -= c > a *= c > > What, specifically, is not readable about this syntax? > As for me, I would even prohibit all these += for the sake of readability. > Great, so I will have to make a copy of my 500 MB array every time I want to do a simple mathematical operation on it rather than being able to do the operation in-place.
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/