Re: Importing Version Specific Modules

2008-12-04 Thread Michael Crute
On Thu, Dec 4, 2008 at 7:33 PM, <[EMAIL PROTECTED]> wrote: >Michael> try: >Michael> from string import Template >Michael> except ImportError: >Michael> from our.compat.string import Template > > This is "easier to ask forgiveness than permission" (EAFP). This tends to > be

Re: Importing Version Specific Modules

2008-12-04 Thread skip
Michael> if sys.version_info[:2] >= (2, 5): Michael> from string import Template Michael> else: Michael> from our.compat.string import Template This is "look before you leap" (LBYL). Michael> try: Michael> from string import Template Michael> except Import

Importing Version Specific Modules

2008-12-04 Thread Michael Crute
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 Templ