3 ms·
If I understand the PEP right, this explanation is missing the part where it's only useful to extend abstract classes; python classes are open so you can just a
by bcoates 13y ago
If I understand the PEP right, this explanation is missing the part where it's only useful to extend abstract classes; python classes are open so you can just add a method to a concrete class to get single-dispatch if that's all you need. I don't think the example given needs generics at all.
- hyperpape 13y agoI had a hard time understanding the value of the idea from this as well. The link I gave made it a bit clearer to me.
- eurleif 13y ago>python classes are open so you can just add a method to a concrete class to get single-dispatch if that's all you need. Except then your method shares a namespace with all the other methods defined on the class, which is ugly, and can cause clashes.