May-02-2017, 09:36 AM
(May-02-2017, 09:21 AM)Mekire Wrote: But from a practical standpoint, for all intents and purposes this distinction is meaningless. __init__ is the constructor as you are generally taught to think about them.I don't think that it's meaningless. And I think that distinction is important.
Understanding this distinction is essential when explaining why
__init__
should not contain return statement. And how __dict__
attribute "magically" appears in descendants of object class (Examples from recent discussions)I don't remember C++ constructors too well - 9 years of abstention and going
![Dance Dance](https://python-forum.io/images/smilies/eusa_dance.gif)
__init__
does - in much clearer way.
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.