rafekettler.com · Saved

A Guide to Python's Magic Methods

www.rafekettler.com/magicmethods.html

From the page

Saved with the link. Notes from 2007 to 2016 are mostly the page's own words, so this is probably an excerpt.

What are magic methods? They're everything in object-oriented Python. They're special methods that you can define to add "magic" to your classes. They're always surrounded by double underscores (e.g. init or lt). They're also not as well documented as they need to be. All of the magic methods for Python appear in the same section in the Python docs, but they're scattered about and only loosely organized. There's hardly an example to be found in that section (and that may very well be by design, since they're all detailed in the language reference, along with boring syntax descriptions, etc.).

Saved the same week · 21 links that week

Everything saved in March 2012