Poor Yorick wrote: > I have a future statement in a script which is intended to work in 2.6 and 3. > Shouldn't compile flags in __future__ objects essentially be noops for > versions > that already support the feature? doctest is complaining about unrecognised > flags. This illustrates the problem: > > Python 3.0 (r30:67507, Dec 3 2008, 20:14:27) [MSC v.1500 32 bit (Intel)] > on win > 32 > Type "help", "copyright", "credits" or "license" for more information. > >>> from __future__ import unicode_literals > >>> src = 'a = "hello"' > >>> c1 = compile(src,'<string>','exec',unicode_literals.compiler_flag) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ValueError: compile(): unrecognised flags > This could arguably be classed as a bug given that the 2.6 documentation for __future__ says "No feature description will ever be deleted from __future__." However I suspect that the feature has been removed because all string literals are Unicode in 3.0 and up, and 3.0 is allowed to break compatibility.
One question is whether the 2to3 translator will remove such an import. If it does then one could argue this is just another of the many expected incompatibilities between 2.x and 3.x. If it doesn't, it should probably be made to. regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list