I do exactly what you just described, see http://www.rafekettler.com/magicmethods.html#appendix
I do exactly what you just described, see http://www.rafekettler.com/magicmethods.html#appendix
Also why put __nonzero__, __str__ and __unicode__ in "Representing your Classes" instead of "Type conversion magic methods"? Why not talk about the collections ABCs for container operators? (using them as mixins greatly implifies implementing containers, and makes it clear what's required and what is not)?
And the __concat__ note is incorrect, that does not exist in the userland datamodel it exists only in the `operator` module and in the C sequence protocol.
Thanks for writing this up!
I stumbled upon this while researching some Python magic. I felt it was a pretty good write-up so I decided to share it with my fellow HN'ers.
Thank you for posting this.