>> Something along the lines of : >> >> if sys.version_info[: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 _______________________________________________ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
