[ZODB-Dev] API question

Tres Seaver tseaver at palladion.com
Tue Jan 15 00:20:56 UTC 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/14/2013 03:33 PM, Marius Gedminas wrote:
> Can you demonstrate the ambiguity?  As I've shown before, I was
> unable to find it, at least with Python 2.x.

On the filesystem:

 $ find src/ZODB/FileStorage/ -name "*.py"
 src/ZODB/FileStorage/fspack.py
 src/ZODB/FileStorage/__init__.py
 src/ZODB/FileStorage/fsdump.py
 src/ZODB/FileStorage/fsoids.py
 src/ZODB/FileStorage/format.py
 src/ZODB/FileStorage/interfaces.py
 src/ZODB/FileStorage/tests.py
 src/ZODB/FileStorage/FileStorage.py

So, 'ZODB.FileStorage.FilesStorage' could logically be either the
'Filestorage' module inside the 'ZODB.FileStorage' package, or else the
same-named class.  As with ZODB.DB, getting to the actual module is
tricky, because both thses imports give you the class::

 from ZODB.FileStorage import FileStorage

and::

 From ZODB.FileStorage.FileStorage import FileStorage

I'm tempted to rename the 'DB.py' module 'db.py', and jam in a BBB entry
in sys.modules for 'ZODB.DB';  likewise, I am tempted to rename the
'FileStorage.py' package 'filestorage', its same-named module
'_filestorage.py', and jam in BBB entries for the old names.

Those renames would make the "preferred" API:

  >>> from ZODB import DB # convenience alias for the class
  >>> from ZODB import db # the moodule
  >>> from ZODB.db import DB # my preferred speling
  >>> from ZDOB.filestorage imoprt FileStorage # conv. alias for class
  >>> from ZODB import filestorage # the package
  >>> from ZODB.filestorage import FileStorage # my preferred speling
  >>> from ZODB.filestorage import _filestorage # if needed

For extra bonus fun, we could rename 'ZODB' to 'zodb' :)



Tres.
- -- 
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlD0oOgACgkQ+gerLs4ltQ4LOwCgu3VSRklLjFMdkuWLkUNV4h2S
m/MAoKMI+ZrTqFUnXkgGNSw7Gq2yYN0V
=67De
-----END PGP SIGNATURE-----



More information about the ZODB-Dev mailing list