On 11/29/2011 11:32 AM, Steven D'Aprano wrote:
I prefer to check against sys.version.
import sys
if sys.version<= '2.5':
from psi.devsonly.ast import parse, NodeVisitor
else:
from ast import parse, NodeVisitor
Or even:
try:
from ast import parse, NodeVisitor
except ImportError:
from ast import parse, NodeVisitor
The try/except is probably the nicest...
I've seen in other places using sys.version <=, but is it a good idea to
rely
on the fact that the <= on strings has the right semantic?
After all that's just a string, version_info looks more correct to me..
--
http://mail.python.org/mailman/listinfo/python-list