14 ms·
This is a great post, but I also want to point out that this page is invaluable to any Python developer wanting to know the details about the magic methods: htt
by mitchellh 15y ago
This is a great post, but I also want to point out that this page is invaluable to any Python developer wanting to know the details about the magic methods: http://docs.python.org/reference/datamodel.html#special-method-names http://docs.python.org/reference/datamodel.html#special-meth...
Whenever working on any reasonably complex class, I find that open in a tab to verify that I'm using the magic methods properly, and that they'll be called as I expect.
- rafekett 15y agoI agree. What I wrote here was based on that. I wanted my post to be more akin to a tutorial than a reference. I don't think the data model reference is useful to people who don't know the basics -- the idea was to bridge that gap so that it could be useful.