magicmethods
magicmethods copied to clipboard
Guide to Python's magic methods
__next__
In Python 3, `next(obj)` calls `obj.__next__` (py3) https://docs.python.org/3/library/stdtypes.html#iterator.__next__
Hello, I am curious as to why `__next__` was not included within the `containers` category or perhaps under a different category, such as, `Iterators`?
The link in the 'about' section of this repo redirects to [this website](http://ww1.rafekettler.com/) which I assume is not yours. The article is available in the HTML format [here](https://rszalski.github.io/magicmethods/). Btw, great...
This magic method is specific to a third-party library, but it's one of the most popular libraries, and implementing the magic method is very useful for making other numeric code...
> when I call x = SomeClass(), __init__ is not the first thing to get called. Actually, it's a method called __new__, which actually creates the instance, This wasn’t clear...
For example: ```python >>> not myObject```
Thanks you @RafeKettler for this comprehensive list of Python magic tricks :) I noticed the `__slots__` is missing, although this attribute has huge effects on the class, see https://docs.python.org/3/reference/datamodel.html#notes-on-using-slots