[Python-Dev] PEP 408 -- Standard library preview package (original) (raw)
Eli Bendersky eliben at gmail.com
Fri Jan 27 17:45:27 CET 2012
- Previous message: [Python-Dev] PEP 408 -- Standard library __preview__ package
- Next message: [Python-Dev] PEP 408 -- Standard library __preview__ package
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Something along the lines of :
if sys.versioninfo[:2] == (3, X): from preview import example else: raise ImportError( 'Package example is only available as preview in Python version 3.X. Please check the documentation of your version of Python to see if and how you can get the package example.' ) A more normal incantation, as is often the way for packages that became parts of the standard library after first being a third party library (sometimes under a different name, e.g. simplejson -> json): try: from preview import thing except ImportError: import thing So no need to target a very specific version of Python.
Yep, this is what I had in mind. And it appeared too trivial to place it in the PEP.
Eli
- Previous message: [Python-Dev] PEP 408 -- Standard library __preview__ package
- Next message: [Python-Dev] PEP 408 -- Standard library __preview__ package
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]