On 18 November 2016 at 01:26, Steven D'Aprano email@example.com wrote:
Sorry, just for a second one more comment to your comment. BTW, Steve, there is no any "battle", only peace and pleasure. And exchange of knowledge and opinions of adult intelligents.
Mikhail, you are missing the point that people have already spent decades thinking about "a better syntax for in-place stuff", and for Python that syntax is augmented assignment.
Wikipedia says they are all the same in all languages. Probably you meant something else. But if there are alternatives, I would look into it. Especially if they are a product of "decades" of work of titans of typography, this must be something divinely beautiful in contrast to current ones.
WAS: Binary_mask += numpy.sum(B, C)
NEW: 1). prefix keyword approach examples:
incal Binary_mask + numpy.sum(B, C) inc Binary_mask + numpy.sum(B, C) calc Binary_mask + numpy.sum(B, C) exec Binary_mask + numpy.sum(B, C)
[...] not one of those examples makes it clear that this is an assignment.
But is it not because you see it first time in your life? That is just one point on the problem of judgement of syntax, regardless of what it be.
Augmented assignment does make it clear: it uses a variation on the = binding operator. (Its not actually an operator, but for lack of a better name, I'll call it one.) It follows the same basic syntax as regular assignment:
target = expression
except that he augmented operator is inserted before the equals sign:
target -= expression target += expression target *= expression
Which makes these two lines:
target -= expression target = expression
Quite similar visually but with absolutely different meaning.
Steven, you always give reviews and advices which exceed all expectations in quality and clearness and I learned a lot from you, serious. But I dare me a light nitpick: probably syntaxes is not your element ;)