> 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. 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. I don't see this pattern in any of the modules you mention above. > to figure out *why* it's a good idea to use a factory function, think > as a user. or as a library maintainer. That helped a lot. Thank you. -- Gustavo Niemeyer [ 2AAC 7928 0FBF 0299 5EB5 60E2 2253 B29A 6664 3A0C ]
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