The __add__ method

__add__(self, other)

These methods are called to implement the binary arithmetic operations (+, -, \*, //, %, divmod(), pow(), \*\*, <``<, ` >`>, &, ^, |). For instance, to evaluate the expression x+y, where x is an instance of a class that has an __add__ method, x.\_\_add\_\_(y) is called. The __divmod__ method should be the equivalent to using __floordiv__ and __mod__; it should not be related to __truediv__ (described below). Note that __pow__ should be defined to accept an optional third argument if the ternary version of the built-in pow function is to be supported.

 

Comment:

"These methods are called to implement the binary arithmetic operations..." It seems to me, this description should apply to all __something__ methods, not just __add__ (note "These").

OffTopic: I would love to contribute. How can I do it? Will you implement wiki someday?

Posted by Alexey Shamrin (2006-12-08)

Comment:

"I would love to contribute. How can I do it?" For now, just keep reviewing things! I doubt we'll turn this into a public wiki, but some kind of "edit through the web" support for trusted users is definitely on the drawing board.

Posted by Fredrik (2007-01-04)

A Django site. rendered by a django application. hosted by webfaction.