On Tue, Sep 14, 2021 at 11:58 PM <[email protected]> wrote: > > Hi all, > > I was wondering on whether there is any interest in introducing a > "plus-minus" operator: > > Conceptually very simple; instead of: > > upper, lower = a + b, a - b > > use instead: > > upper, lower = a +- b > > In recent projects I've been working on, I've been having to do the above > "plus minus" a lot, and so it would simplify/clean-up/reduce error potential > cases where I'm writing the results explicitly. > > It isn't a big thing, but seems like a clean solution, that also takes > advantage of python's inherent ability to return and assign tuples.
As an operator, this wouldn't work, since it's ambiguous with adding negative b to a (ie "a + -b"). But as Paul said, this is perfect for a very simple function. ChrisA _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/4VFL4OI4NQC6EONP7YD5RG26PRDSTM5A/ Code of Conduct: http://python.org/psf/codeofconduct/
