Re: [pysqlite] PySqlite crazy import
Roger Binns <[email protected]> Sun, 08 Feb 2009 02:19:55 -0800
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 anatoly techtonik wrote: > Why does sqlite has so crazy import? > > from pysqlite2 import dbapi2 as sqlite3 It let you select things. There is also a pysqlite1. There are two different versions of dbapi with a 3rd on the way. The standard pysqlite shipped with Python is just plain sqlite3. > import sqlite3 Yes, just like that. However sometimes people want a newer version than whatever is shipped with Python. Using the top "from ... as sqlite3" means the module ends up being imported as the name "sqlite3" whether you are using the external or internal (to Python) module. The docs from Python.org are just plain "import sqlite3": http://docs.python.org/library/sqlite3.html Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkmOsccACgkQmOOfHg372QQWaACeMIXlbVVJmFLjUm9r6NMaRn+t mAoAnjWOpNIpOtQwF65+DM95E4BV9/xu =md4O -----END PGP SIGNATURE-----