Nick Coghlan added the comment:

The background here is the change in http://bugs.python.org/issue17636 that 
allows IMPORT_FROM to fall back to sys.modules when written as "from a.b import 
c as m", while the plain LOAD_ATTR generated for "import a.b.c as m" fails.

One potential resolution to the discrepancy that occurred to me in the 
python-ideas discussion was to add a new IMPORT_ATTR opcode specifically for 
use in the latter case.

The main downside I can see is the usual one with adding any new opcode for a 
niche use case like this one: it risks slowing the eval loop down in general 
for a marginal improvement in language consistency.

However, I don't think we should reject the possibility out of hand on that 
basis.

----------
nosy: +brett.cannon, eric.snow, ncoghlan

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30024>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to