Just want to say that I'm happy to see that lately the disadvantages of inheritance (which are already known for a very long time) are getting more attention. It's not bad by definition, but there's so much truth in Sandy her talk and I think for many Python projects, we went way too far into "abusing" inheritance. Actually, it's a bit unfortunate that we made inheritance so user friendly and powerful in Python that for many people it became the logical way to extend or reuse some code.
2015-10-21 19:41 GMT+02:00 Sven R. Kunze email@example.com:
On 21.10.2015 00:50, Chris Angelico wrote:
She recommends a massive superclass that's capable of any form of injection
Nope. She does not.
The "superclass" is not "massive" at all. It is even slimmer as orthogonal aspects are refactored out into separate entities. In fact, it makes it even easier to test and maintain these separate aspects (the core dev should be interested in that). Furthermore, it's, of course, up to debate which aspects should be injectable and which are not.
Just imagine, I would need to use several orderings and/or a default value for missing keys:
normal_dict = dict() ordered_dict = dict(order=dict.order_by_insert) sorted_dict = dict(order=sorted) sorted_default_dict = dict(order=sorted, default=int)
How many subclasses am I supposed to write, maintain and upgrade (in case Guido rewrites his precious dict implementation)? I would even allege that for sufficiently large teams and projects, there are *multiple* implementations with the same intent.
PS: the instances above are real-world examples, I remember requiring during the course of the last year.
Python-ideas mailing list Pythonfirstname.lastname@example.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/