3 ms·
I've been a Python instructor for 5+ years and I've never taught to my students that __init__ is not a constructor. That is I teach that __init__ works just lik
by sireat 4y ago
I've been a Python instructor for 5+ years and I've never taught to my students that __init__ is not a constructor. That is I teach that __init__ works just like a constructor.
Sure technically (the best type of correct) it is not a constructor.
Where would this be important? Maybe it could be taught as part of "language lawyer" course.
I teach OOP around lesson 10. Each lesson is about 2hours.
Complete beginnners to programming are able create basic classes and even inheritance.
Some people like OOP some stick with imperative style. Some migrate to more functional style (which I personally advocate).
Going through this old thread: https://stackoverflow.com/questions/6578487/init-as-a-constructor https://stackoverflow.com/questions/6578487/init-as-a-constr... puts me firmly into "this is hair-spliting" camp.
- bmelton 4y ago> Where would this be important FAANG interviews? Knowing that __new__() comes before __init__() is probably useful, as the deeper one gets into a language the more important it is to understand the lifecycle of an object. Otherwise, the only thing I can think of that's special is understanding that and how it works as a singleton.
- gautamdivgi 4y agoI’ve been through a couple of those. I’ve never been asked language specific questions. Most FAANG code interviews don’t care much about which language you choose. I’ve also not seen them care if you use OO or don’t. Either way works - as long as your algorithm is good. In short this is irrelevant for those interviews. It’s definitely relevant if you do python as a day job.
- PreachSoup 4y agoNo, it's the opposite. Big tech don't care about these. Internally their language style are as generic as possible. They want you to avoid warts and gotchas and make every oop language usage look the same so that you can actually jump around different the projects