[Python-Dev] Re: tarfile module (update) (original) (raw)
Fredrik Lundh fredrik@pythonware.com
Wed, 27 Nov 2002 10:08:11 +0100
- Previous message: [Python-Dev] Re: tarfile module (update)
- Next message: [Python-Dev] Re: tarfile module (update)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Gustavo Niemeyer wrote:
> There is a two-level public API to tarfile. The low-level API which = is > the TarFile class with its init(), and the high-level API which = is > the module-level open() function. [...] =20 Ok, but I still belive that the default constructor should be the most common used interface, just like most (all) of the standard library.
using factory functions to create objects representing external entities is an extremely common pattern.
in the Pythobn library, this pattern is used in aifc, anydbm, audiodev, dbhash, dumbdbm (and all other dbm modules), fileinput, gettext, gopherlib, gzip, imghdr, optparse, popen2, shelve, sndhdr, socket, sunau, sunaudio, tempfile, tokenize, just to name a few.
to figure out why it's a good idea to use a factory function, think as a user. or as a library maintainer.
(yes, PIL's using it too)
- Previous message: [Python-Dev] Re: tarfile module (update)
- Next message: [Python-Dev] Re: tarfile module (update)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]