[Python-Dev] Re: tarfile module (update)
Fredrik Lundh
fredrik@pythonware.com
Wed, 27 Nov 2002 14:06:03 +0100
Gustavo Niemeyer wrote:
> > using factory functions to create objects representing external
> > entities is an extremely common pattern.
> >=20
> > 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.
>=20
> Perhaps I haven't explained it right. I was trying to tell that using =
a
> default constructor would be more obvious than having a methodclass
> "constructor" TarFile.open() which will be used 99.9% of the time.
the mail you replied to talked about a module-level open() function,
not a class method.
> 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
</F>