[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-dev
Subject:    Re: [Python-Dev] PEP 408 -- Standard library __preview__ package
From:       Philippe Fremy <phil () freehackers ! org>
Date:       2012-01-27 16:09:08
Message-ID: 4F22CC24.1080802 () freehackers ! org
[Download RAW message or body]

On 27/01/2012 16:25, Michael Foord wrote:
> 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.
> 

According to the PEP, the interface may change betweeen __preview__ and
final inclusion in stdlib. It would be unwise as a developer to assume
that a program written for the preview version will work correctly in
the stdlib version, wouldn't it ?

I would use your "normal" incantation only after checking that no
significant API change have occured after stdlib integration.

By the way, if as Antoine suggests, the package remain available in
__preview__ even after it's accepted in the stdlib, how is the user
supposed to deal with possible API changes ?

cheers,

Philippe





_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-dev%40progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic