[Python-Dev] Alternative imports (Re: Python 3 design principles)
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Sep 1 05:32:45 CEST 2005
More information about the Python-Dev mailing list
Thu Sep 1 05:32:45 CEST 2005
- Previous message: [Python-Dev] Python 3 design principles
- Next message: [Python-Dev] Python 3 design principles
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Oren Tirosh wrote:
> Writing programs that run on both 2.x and 3 may require ugly
> version-dependent tricks like:
>
> try:
> compile
> except NameError:
> from sys import compile
Just had a weird thought. What if you could write
from sys or __builtin__ import compile
which would be equivalent to
try:
from sys import compile
except ImportError:
from __builtin__ import compile
Greg
- Previous message: [Python-Dev] Python 3 design principles
- Next message: [Python-Dev] Python 3 design principles
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list