4 ms·
- Inheritance: You could, but I really don't see the point of this in the first place. - isinstance/issubclass: Duck typing is good, but the ability to check i
by AnkhMorporkian 12y ago
- Inheritance: You could, but I really don't see the point of this in the first place.
- isinstance/issubclass: Duck typing is good, but the ability to check if you really need to is really good to have.
When I was talking about class specific methods, I was talking about __str__, __repr__, __cmp__, __hash__, etc.
By different type I meant that this will read as a dict and not a class if you check the type.
Sure, you could reimplement a lot of these things if you made a subclass of dict, implemented a __call__ method, yadda yadda, but at that point you're basically recreating what type() already does.