new vs init in Python
Try Hostinger: Use coupon code MCODING at checkout for up to 91 off all yearly hosting plans Thanks to Hostinger for sponsoring this video IN THIS What s the difference between the new and init magic methods in Python New is for object creation, and init is for object initialization. It is rare that a programmer would actually need to override new, so let s see some examples of how it can be used. mCoding with James Murphy Source code: Python new docs: tpnew in CPython: C extension example: Singleton pattern: SUPPORT ME
|
|