[Python-Dev] PEP 549: Instance Properties (aka: module properties) (original) (raw)
Ronald Oussoren ronaldoussoren at mac.com
Wed Sep 6 17:13:39 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 6 Sep 2017, at 00:03, Larry Hastings <larry at hastings.org> wrote:
I've written a PEP proposing a language change: https://www.python.org/dev/peps/pep-0549/ <https://www.python.org/dev/peps/pep-0549/> The TL;DR summary: add support for property objects to modules. I've already posted a prototype. How's that sound?
To be honest this sounds like a fairly crude hack. Updating the class of a module object feels dirty, but at least you get normal behavior w.r.t. properties.
Why is there no mechanism to add new descriptors that can work in this context?
BTW. The interaction with import is interesting… Module properties only work as naive users expect when accessing them as attributes of the module object, in particular importing the name using “from module import prop” would only call the property getter once and that may not be the intended behavior.
Ronald
-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20170906/0a0f2977/attachment.html>
- 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 ]