On Fri, Apr 2, 2021 at 11:58 AM Richard Damon <rich...@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-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/PDIE6D6NB2EFKRROYK23LOSRQACXWMYC/ Code of Conduct: http://python.org/psf/codeofconduct/