News for hackers. Stuff that matters.
Re:I'm Switching to Python and Actually Liking It by 63stack on Wednesday July 16, 2025 @06:00AM (#44580504)
Would you consider a constructor magic though?
Re:I'm Switching to Python and Actually Liking It by lou1306 on Wednesday July 16, 2025 @06:08AM (#44580538)
"Magic methods" is just the name people use for these special methods (another is dunder methods). They're "magic" because you do not call them by name, rather they are invoked by the interpreter in specific situations.
Re:I'm Switching to Python and Actually Liking It by dragonwriter on Wednesday July 16, 2025 @02:31PM (#44585425)
Yes, it is magic the same way other magic methods are, that is, because it is syntactically special and callable (and primarily called by) a syntax other than <instance>.<method>(...) or <class>.<method>(instance, ...)

Specifically, in the case of constructors, via <class>(...).