[Python-ideas] "Loose" descriptors
Greg Ewing
greg.ewing at canterbury.ac.nz
Sat Mar 28 23:51:31 CET 2015
James Edwards wrote:
> I envision (but with no real knowledge of the implications of this)
> that just as python identifies that `val` in `Holder.__dict__`
> implements `__get__`, python could similarly identify that `val` in
> `globals()` (or `sys.modules[__name__].__dict__`, or wherever is more
> appropriate) implements `__get__` and handle the indirection.
This would slow down *all* lookups of global names in
order to support a rarely-used feature. Since global
name lookup is critical performance-wise, this is
likely to meet a lot of resistance.
Similar arguments have been made concerning the
support of descriptors in module namespaces, which
is a closely related idea.
--
Greg
More information about the Python-ideas
mailing list