Skip to content
Merged
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions Doc/library/zipimport.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,19 @@ Here is an example that imports a module from a ZIP archive - note that the

.. code-block:: shell-session

$ unzip -l example.zip
Archive: example.zip
$ unzip -l example_archive.zip
Archive: example_archive.zip
Length Date Time Name
-------- ---- ---- ----
8467 11-26-02 22:30 jwzthreading.py
8467 05-11-25 12:29 example.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we use a clearly example time, rather than one that will get dated?

Suggested change
8467 05-11-25 12:29 example.py
8467 01-01-00 12:34 example.py

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably best not so we will know (or people will notice) to update the example if we ever make breaking changes to zipimport. I don't think it is worth it, but it doesn't matter

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand your comment. The code block here is for unzip, where we're already inventing an archive for expository purposes.

Copy link
Contributor Author

@sharktide sharktide Aug 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My phone has aggressive autocorrect and my misspelling resulted in unzip turning into zipimporter.

But on second thoughts, by keeping the time and date specific, we know what version of Python it was written in and if we ever change anything even methods we keep for expository purposes someone will notice and fix it.

I also don't think it matters that much :).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But on second thoughts, by keeping the time and date specific, we know what version of Python it was written in and if we ever change anything even methods we keep for expository purposes someone will notice and fix it.

I'm not sure I understand. If we break this (which is unlikely), we'll update the example anyway. Knowing when something was written generally doesn't have much maintenance benefit.

I think I agree with Adam -- it'd be better to make this clearer that it's an example and not supposed to be actual data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right.

-------- -------
8467 1 file
$ ./python
Python 2.3 (#1, Aug 1 2003, 19:54:32)

.. code-block:: pycon

>>> import sys
>>> sys.path.insert(0, 'example.zip') # Add .zip file to front of path
>>> import jwzthreading
>>> jwzthreading.__file__
'example.zip/jwzthreading.py'
>>> sys.path.insert(0, 'example_archive.zip') # Add .zip file to front of path
>>> import example
>>> example.__file__
'example_archive.zip/example.py'

Loading