A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-January/115864.html below:

[Python-Dev] PEP 408 -- Standard library __preview__ package

[Python-Dev] PEP 408 -- Standard library __preview__ package [Python-Dev] PEP 408 -- Standard library __preview__ packageEli Bendersky eliben at gmail.com
Fri Jan 27 17:45:27 CET 2012
>> 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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4