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>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4