> On 6 Sep 2017, at 00:03, Larry Hastings <la...@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

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to