[Python-Dev] PEP 549: Instance Properties (aka: module properties) (original) (raw)
Cody Piersall cody.piersall at gmail.com
Wed Sep 6 13:13:52 EDT 2017
- Previous message (by thread): [Python-Dev] PEP 549: Instance Properties (aka: module properties)
- Next message (by thread): [Python-Dev] PEP 549: Instance Properties (aka: module properties)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, Sep 6, 2017 at 10:26 AM, Guido van Rossum <guido at python.org> 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?) -- --Guido van Rossum (python.org/~guido)
I think a more natural way for the dir problem would be to update module_dir() in moduleobject.c to check if all is defined and then just return that list if it is defined. I think that would be a friendlier default for dir anyway.
Cody
- Previous message (by thread): [Python-Dev] PEP 549: Instance Properties (aka: module properties)
- Next message (by thread): [Python-Dev] PEP 549: Instance Properties (aka: module properties)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]