A Guide to Python's Magic Methods
Free

A Guide to Python's Magic Methods

By Rafe Kettler
Free
Book Description


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

Table of Contents
  • Page 1
  • Page 2
  • Page 3
  • Page 4
  • Page 5
  • Page 6
  • Page 7
  • Page 8
  • Page 9
  • Page 10
  • Page 11
  • Page 12
  • Page 13
  • Page 14
  • Page 15
  • Page 16
  • Page 17
  • Page 18
  • Page 19
    No review for this book yet, be the first to review.
      No comment for this book yet, be the first to comment
      You May Also Like
      Also Available On
      Categories
      Curated Lists