I assume it's always April 1 somewhere on Earth. :-)




On Fri, Apr 2, 2021, 12:13 PM Jonathan Goble <jcgoble3@gmail.com> wrote:
On Fri, Apr 2, 2021 at 11:58 AM Richard Damon <Richard@damon-family.org> wrote:
I think python only has 3 unary operations, + - and ~ and only + and -
can also be binary operations.

unary + has less uses, since it normally just passes its argument, if
valid, unchanged, but can be used to validate that its argument has the
right type. I am not sure if a type could define its own unary+ to do
something special, but I thought it could.

Yes, it can via the __pos__ dunder.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@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/PDIE6D6NB2EFKRROYK23LOSRQACXWMYC/
Code of Conduct: http://python.org/psf/codeofconduct/