IT/Programming

[Python] Dunder Method

nofence 2024. 4. 9. 18:06

파이썬에서 더블 언더스코어(__)로 명명되는 메서드가 무수히 존재하는데, 이를 '매직 메서드'라고

칭하고 '던더 메서드'라고 표현되기도 한다.

 

* 참고

Python Magic methods are the methods starting and ending with double underscores ‘__’. 

They are defined by built-in classes in Python and commonly used for operator overloading. 

They are also called Dunder methods, Dunder here means “Double Under (Underscores)”.

Python Magic Methods
Built in classes define many magic methods, dir() function can show you magic methods 

inherited by a class.

https://www.geeksforgeeks.org/dunder-magic-methods-python/