[Python-Dev] PEP 549: Instance Properties (aka: module properties) (original) (raw)

Ethan Furman ethan at stoneleaf.us
Mon Sep 11 21:54:21 EDT 2017


On 09/06/2017 08:26 AM, Guido van Rossum wrote:

So we've seen a real use case for class assignment: deprecating things on access. That use case could also be solved if modules natively supported defining getattr (with the same "only used if attribute not found otherwise" semantics as it has on classes), but it couldn't be solved using @property (or at least it would be quite hacky).

Is there a real use case for @property? Otherwise, if we're going to mess with module's getattro, it makes more sense to add getattr, which would have made Nathaniel's use case somewhat simpler. (Except for the dir thing -- what else might we need?)

Doesn't assigning a module's class make it so we can already write properties, descriptors, getattr, etc. ? Are these other things so common that we need /more/ syntax for them?

-- Ethan



More information about the Python-Dev mailing list