Am I correct in assuming that an object in Python has a default implementation of all magic methods (the ones surrounded by the double underscore, such as __init__)?
No.
>>> object.__add__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'object' has no attribute '__add__'
Some of them do have default implementations, like __init__, but most of them don't.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With