[Python-Dev] PEP 408 -- Standard library __preview__ package
Michael Foord
fuzzyman at voidspace.org.uk
Fri Jan 27 16:25:28 CET 2012
On 27/01/2012 14:37, Philippe Fremy wrote:
> Hi,
>
> A small comment from a user perspective.
>
> Since a package in preview is strongly linked to a given version of
> Python, any program taking advantage of it becomes strongly specific to
> a given version of Python.
>
> Such programs will of course break for any upgrade or downgrade of
> python version. To make the reason for the breakage more explicit, I
> believe that the PEP should provide examples of correct versionned usage
> of the module.
>
> 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.
Michael
>
> cheers,
>
> Philippe
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk
>
--
http://www.voidspace.org.uk/
May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html
More information about the Python-Dev
mailing list