M.-A. Lemburg wrote:
> On 2008-09-10 00:26, [EMAIL PROTECTED] wrote:
>> mal> Besides, what's so bad with downloading and installing a package
>> mal> from PyPI ?
>>
>> Nothing, I do it all the time. But my impression is that when an external
>> module moves into the core it frequently undergoes some type of name change
>> (e.g. pysqlite vs sqlite3 or Optik vs optparse) even if the two versions are
>> functionally identical. In this case, my hope is that dbm.sqlite will
>> eventually move into the distributed dbm package. If so, it would be nice
>> if the move was transparent.
>
> Transparent as in "I don't have to change my code" ?
>
> I actually find it helpful to have the PyPI packages that ended up in
> the stdlib use different names, since that opens up the possibility
> to use the more current releases from PyPI in an application.
>
> Switching back to the core version usually just takes a one line
> change, if at all...
>
> try:
> import pysqlite as sqlite
> except ImportError:
> import sqlite3 as sqlite
>
I still think it would be kind of nice to be able to write that as:
import pysqlite or sqlite3 as sqlite
(ditto for "from pysqlite or sqlite3 import <whatever>")
You could even do it as a pre-AST transform (similar to
try/except/finally) and not even have to go anywhere near the
implementation of the import system itself.
I've never been motivated enough to write a PEP about it though.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com