Add you can call this function plusminus Then use the funcoperators module to write :
upper, lower = a +plusminus- b pip install funcoperators Le mar. 14 sept. 2021 à 16:02, Paul Moore <p.f.mo...@gmail.com> a écrit : > I doubt it, it seems way too specialised to be worth making into a > language feature. > > If you want to, you can write a function: > > def limits(a, b): > return a+b, a-b > > Paul > > On Tue, 14 Sept 2021 at 14:55, <yah...@gmail.com> 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. > > _______________________________________________ > > Python-ideas mailing list -- python-ideas@python.org > > To unsubscribe send an email to python-ideas-le...@python.org > > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/MCAS5B63Q6ND74GEBP2N3OF3HLISSQMA/ > > Code of Conduct: http://python.org/psf/codeofconduct/ > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/XYRRZPCPWF6VJTBX3MAWCIQEWXJC5F3X/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/527MLDIJ3EHBPGSS2KJ4CBP3RVMR4JBZ/ Code of Conduct: http://python.org/psf/codeofconduct/