[Python-ideas] Making it easy to prepare for PEP479
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue May 19 00:48:41 CEST 2015
Joao S. O. Bueno wrote:
> (Otherwise
> from __future__ import from__future__import_ImportError
> seens fun enough to actually be created)
I don't think it would even be all that hard to implement.
As I understand things, a __future__ import already
results in a run-time import in addition to its magical
effects. So all the compiler needs to do is ignore
undefined future features, and an ImportError will
result at run time.
(The rules would need to be relaxed slightly to
allow a try-except around future imports, but that
doesn't seem like a big problem.)
A benefit of this arrangement is that it would permit
monkey-patching of __future__ at run time to get
no-ops.
--
Greg
More information about the Python-ideas
mailing list