Message341004
Here: https://docs.python.org/3/reference/datamodel.html#object.__get__
The __get__ signature is defined as:
object.__get__(self, instance, owner)
But here: https://docs.python.org/3/howto/descriptor.html#descriptor-protocol
It is defined as:
descr.__get__(self, obj, type=None)
It is not clear to me as a reader if all descriptors should have the owner/type argument default to None or if it should be required. If it should default to None, I think all doc examples should follow this expectation to make it clear to someone implementing a descriptor for the first time. As best I can tell, the owner/type is always passed. So perhaps the =None shouldn't be there.
Grepping the CPython code, I see lots of definitions for both required and optional, adding more confusion for me.
If there is a definitive answer, I'm happy to follow through by updating the docs. |
|
Date |
User |
Action |
Args |
2019-04-27 17:56:43 | jdufresne | set | recipients:
+ jdufresne, docs@python |
2019-04-27 17:56:43 | jdufresne | set | messageid: <1556387803.45.0.177981206888.issue36743@roundup.psfhosted.org> |
2019-04-27 17:56:43 | jdufresne | link | issue36743 messages |
2019-04-27 17:56:42 | jdufresne | create | |
|