Message255685
Here are some specific changes I suggest:
1. Most confusing: super() uses the MRO of the second argument, not the first.
2. Clarify that is is not just the first argument that is skipped in the MRO, it is all preceding classes as well. The first argument does not have to be the class at the start of the MRO.
3. Revise signature and use consistent parameter names in text. Currently, “obj” and “type2” are only defined in the doc string. Perhaps super(subclass[, self]). Or maybe super(type[, obj]), matching error messages, or super(thisclass[, self]), matching the special attributes. Type and type2 are too confusing for my taste.
4. Link to the glossary rather than getattr().
5. Explain more about unbound super objects, when the second argument is omitted. Apparently they are descriptors; when you set them on a class and then “get” them in an instance, you get a new version bound to that instance. This is obscure, but I feel it might help the general understanding. [It seems you cannot bind a super() object to a class this way; maybe that is a bug.]
6. Explain more about “bound” super objects: getting a method from the super object binds the method to the second argument. [This also works for getting data properties, but not setting or deleting them; see Issue 14965.]
7. Not only isinstance() or issubclass() must be satisfied, but the first argument must be a concrete class. Virtual subclassing is not sufficient if the subclass is not in the MRO. This would address Issue 20503. Also, the first argument should be a derived class, not “object” itself. |
|
Date |
User |
Action |
Args |
2015-12-02 00:52:56 | martin.panter | set | recipients:
+ martin.panter, rhettinger, r.david.murray, docs@python, Tapani Kiiskinen |
2015-12-02 00:52:56 | martin.panter | set | messageid: <1449017576.56.0.117345798389.issue23674@psf.upfronthosting.co.za> |
2015-12-02 00:52:56 | martin.panter | link | issue23674 messages |
2015-12-02 00:52:55 | martin.panter | create | |
|