On Wed, Feb 3, 2010 at 05:27, Nick Coghlan <ncogh...@gmail.com> wrote: > Glenn Linderman wrote: >> On approximately 2/2/2010 7:05 PM, came the following characters from >> the keyboard of Guido van Rossum: >>> On Tue, Feb 2, 2010 at 5:41 PM, Glenn >>> Linderman<v+pyt...@g.nevcal.com> wrote: >>>> Agreed. But in reading that, it somehow triggered a question: >>>> does zipimport only work for zipfiles, or does it work for any >>>> archive format that Python stdlib knows how to decode? And if >>>> only the former, why are they so special? >>>> >>> The former. >>> >>> They are special because (unlike e.g. tar files) you can read the >>> table of contents of a zipfile without parsing the entire file. >> >> They are not unique in this... most archive formats except tar have a >> directory. But that is likely a good reason not to support tar for >> this purpose, especially since tar usually comes found as .tar.Z or >> .tar.gz or .tar.bz2 etc. and would require two passes before the data >> could be found at all. > > It's also because nobody has done the work to hook up any additional > archive formats (as zipimport needs to work for importing the standard > library itself, it isn't quite as simple as just importing an extra > module to do the manipulation. Extending the test suite to cover a new > archive format would require some work as well). > > Given that zip files already work and are almost universal, I figure > folks have just opted to use that and then found other things to do with > their coding time :) >
If people really need alternative archive formats they can use the importers package: http://packages.python.org/importers/ . If someone really wants to use another format they can use the ABCs in the package to easily write their own importer. It also contains a sqlite3 importer and its own zip importer. -Brett > Cheers, > Nick. > > -- > Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia > --------------------------------------------------------------- > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/brett%40python.org > _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com