KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Which method makes the most sense for importing a module in python that is version specific? My use case is that I'm writing code that will be deployed into a python 2.3 environment and in a few months be upgraded to python 2.5. This: if sys.version_info[:2] >= (2, 5): from string import Template else: from our.compat.string import Template or this try: from string import Template except ImportError: from our.compat.string import Template I know that either case is equally correct and works correctly but which one is preferable?
Tags (comma-separated)
Save Edits
Cancel