Re: [pysqlite] PySqlite crazy import
Gerhard Häring <[email protected]> Sun, 08 Feb 2009 11:28:42 +0100
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
anatoly techtonik wrote:
> Hi,
>
> Why does sqlite has so crazy import?
>
> from pysqlite2 import dbapi2 as sqlite3
>
> It's not pythonic at all.
"Make everything as simple as possible, but not simpler." (Albert Einstein)
> Why not to invent something more intuitive? Like:
>
> import sqlite3
Use Python 2.5 or higher and you can do exactly this, because a stable
version of pysqlite is available under this name in the standard library
of Python 2.5, 2.6, 3.0, ...
> or
>
> from sqlite import sqlite3
The reason for the naming is that the name "sqlite" is already taken for
the pysqlite 1 API. This API had so many issues that I decided to make a
clean cut in 2004 and developed pysqlite 2.0 from scratch.
To not be an asshole for users and package maintainers, I needed a new
namespace for this. So upon discussion on the pysqlite mailing list
(then hosted at initd.org, don't have the archives right now, sorry), I
decided upon a future-proof naming scheme.
Package name: pysqlite{API-VERSION}
Module name: dbapi{DB-API-VERSION}
If a DB-API 3.0 ever surfaces and pysqlite should ever have a new
backwards-incompatible API (not likely), there could be a "from
pysqlite3 import dbapi3" ...
It also allows for developing a proprietary API for pysqlite.
"pysqlite2.native", "pysqlite2.apsw", all possible ;-)
And btw. it was a conscious decision to name the module in the standard
library differently. The experiences with the XML package that did not
do so were quite unpleasant.
-- Gerhard