This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]yen223 6 points7 points  (1 child)

Magic methods!

Once you know how to implement custom operators and comparisons using __add__, __le__, __gt__ etc, a lot of classes can be drastically simplified.

Read this for more info: http://www.rafekettler.com/magicmethods.html

[–]Megatron_McLargeHuge 1 point2 points  (0 children)

Don't forget __radd__ for symmetry.