I still don't follow. How does one use InstanceDescriptor?
import collections.abc
class CustomInstanceProperty(collections.abc.InstanceDescriptor):
def __get__(self, instance, owner):
print("CustomInstanceProperty.__get__ called!")
return 44
cip = CustomInstanceProperty()
Is this still about modules, or is it a generalization of properties for non-module instances? (If it is specific to modules, why doesn't it have "module" in its name? Or if it's not, why is it in this discussion?)
I found that link in the PEP, but it's just a branch of a fork of cpython. It would be easier to review the prototype as a PR to upstream cpython.The prototype is linked to from the PEP; for your convenience here's a link:
https://github.com/larryhastings/cpython/tree/ module-properties