Backwards Compatibility of Python versions
Ben Wolfson
wolfson at uchicago.edu
Sun Feb 3 01:29:36 EST 2002
On Sat, 02 Feb 2002 23:55:38 -0600, Joshua Macy wrote:
> try:
> from __future__ import division
> except ImportError:
> pass
This construct is illegal, as __future__ imports must be the first
statements in a module.
##tmp.py:
try:
from __future__ import division
except ImportError:
pass
##interpreter:
Python 2.2 (#1, Dec 22 2001, 14:06:34)
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-81)] on linux2
Type "copyright", "credits" or "license" for more information.
IDLE 0.8 -- press F1 for help
>>> import tmp
Traceback (most recent call last):
File "<pyshell#0>", line 1, in ?
import tmp
SyntaxError: from __future__ imports must occur at the beginning of the
file (tmp.py, line 2)
>>>
--
BTR
BEN WOLFSON HAS RUINED ROCK MUSIC FOR A GENERATION
-- Crgre Jvyyneq
More information about the Python-list
mailing list