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

Reply via email to