A Guide to Python's Magic Methods « rafekettler.com


28 bookmarks. First posted by hellified july 2017.


A guide to all the Magic Methods in Python
programming  python  reference  bestpractices  magicmethods 
8 weeks ago by e2b
A guide to all the Magic Methods in Python
python  coding  reference 
12 weeks ago by mcky
A guide to all the Magic Methods in Python
programming  python 
august 2018 by kger
This guide is the culmination of a few months' worth of blog posts. The subject is magic methods.

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.).

So, to fix what I perceived as a flaw in Python's documentation, I set out to provide some more plain-English, example-driven documentation for Python's magic methods. I started out with weekly blog posts, and now that I've finished with those, I've put together this guide.

I hope you enjoy it. Use it as a tutorial, a refresher, or a reference; it's just intended to be a user-friendly guide to Python's magic methods.
python  programming  bestpractices  reference  magicmethods 
august 2018 by jotjotjes
A guide to all the Magic Methods in Python
python 
august 2018 by geetarista
A guide to all the Magic Methods in Python
python  bestpractices 
august 2018 by synergyfactor
Documenting magic in Python
from twitter_favs
august 2018 by jim68000