Python's most DISLIKED __dunder__ (and what to use instead)

Published: 05 June 2022
on channel: mCoding
103,328
4.1k

What is your least favorite?

What is the most universally despised _dunder_ method in Python? It's __del__! From it's non-obvious relationship with del, to it's exception-ignoring behavior, to the uncertainty of whether the interpreter will call it 0 or multiple times, it's a real mess!

― mCoding with James Murphy (https://mcoding.io)

Source code: https://github.com/mCodingLLC/VideosS...
with statement docs: https://docs.python.org/3/reference/c...
dunder del docs: https://docs.python.org/3/reference/d...
weakref docs: https://docs.python.org/3/library/wea...
Plus equals video:    • Python's sharpest corner is ... plus ...  
Dunder new video:    • __new__ vs __init__ in Python  
Metaclasses video:    • Metaclasses in Python  

SUPPORT ME ⭐
---------------------------------------------------
Patreon:   / mcoding  
Paypal: https://www.paypal.com/donate/?hosted...
Other donations: https://mcoding.io/donate

Top patrons and donors: Jameson, Laura M, Vahnekie, Dragos C, Matt R, Casey G, Johan A, John Martin, Jason F, Mutual Information, Neel R

BE ACTIVE IN MY COMMUNITY 😄
---------------------------------------------------
Discord:   / discord  
Github: https://github.com/mCodingLLC/
Reddit:   / mcoding  
Facebook:   / james.mcoding