Unary plus operator and __pos__
Andrew Durdin
adurdin at gmail.com
Mon Sep 27 01:14:27 EDT 2004
On Mon, 27 Sep 2004 01:50:43 -0300, Carlos Ribeiro <carribeiro at gmail.com> wrote:
>
> Now I'm curious about the operator itself. Why is the unary plus
> operator associated with the __pos__ magic method? I' can't see a
> relation here, and I could not find much info (although I haven't
> really looked very hard :-)
>
> Anyone knows why is it so?
Because the unary minus is "associated with" __neg__ (negative). I
guess that __pos__ (positive) was introduced to be consistent.
More information about the Python-list
mailing list