PEP 615: consistent terminology (#1586)
* PEP-615 consistent terminology It repeatedly refers to a ZoneInfo object as a "file", confusing it with either the file it was constructed from, or the IO object representing the file. * Further clarification of caching implications
This commit is contained in:
parent
7cff39a91d
commit
b085b2ddfa
20
pep-0615.rst
20
pep-0615.rst
|
@ -134,7 +134,7 @@ behavior for end users.
|
||||||
``ZoneInfo`` objects are ejected when no references to them exist (for
|
``ZoneInfo`` objects are ejected when no references to them exist (for
|
||||||
example, a cache implemented with a ``weakref.WeakValueDictionary``) — it is
|
example, a cache implemented with a ``weakref.WeakValueDictionary``) — it is
|
||||||
allowed but not required or recommended to implement this with a "strong"
|
allowed but not required or recommended to implement this with a "strong"
|
||||||
cache, where all ``ZoneInfo`` files are kept alive indefinitely.
|
cache, where all ``ZoneInfo`` objects are kept alive indefinitely.
|
||||||
|
|
||||||
.. code-block::
|
.. code-block::
|
||||||
|
|
||||||
|
@ -190,11 +190,11 @@ of the interpreter, it must not invalidate any caches or modify any
|
||||||
existing ``ZoneInfo`` objects. Newly constructed ``ZoneInfo`` objects, however,
|
existing ``ZoneInfo`` objects. Newly constructed ``ZoneInfo`` objects, however,
|
||||||
should come from the updated data source.
|
should come from the updated data source.
|
||||||
|
|
||||||
This means that the point at which a ``ZoneInfo`` file is updated depends
|
This means that the point at which the data source is updated for new
|
||||||
primarily on the semantics of the caching behavior. The only guaranteed way to
|
invocations of the ``ZoneInfo`` constructor depends primarily on the semantics
|
||||||
get a ``ZoneInfo`` file from an updated data source is to induce a cache miss,
|
of the caching behavior. The only guaranteed way to get a ``ZoneInfo`` object
|
||||||
either by bypassing the cache and using ``ZoneInfo.no_cache`` or by clearing the
|
from an updated data source is to induce a cache miss, either by bypassing the
|
||||||
cache.
|
cache and using ``ZoneInfo.no_cache`` or by clearing the cache.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ An example:
|
||||||
|
|
||||||
|
|
||||||
When a ``key`` is not specified, the ``str`` operation should not fail, but
|
When a ``key`` is not specified, the ``str`` operation should not fail, but
|
||||||
should return the file's ``__repr__``::
|
should return the objects's ``__repr__``::
|
||||||
|
|
||||||
>>> zone = ZoneInfo.from_file(f)
|
>>> zone = ZoneInfo.from_file(f)
|
||||||
>>> str(zone)
|
>>> str(zone)
|
||||||
|
@ -299,7 +299,7 @@ Rather than serializing all transition data, ``ZoneInfo`` objects will be
|
||||||
serialized by key, and ``ZoneInfo`` objects constructed from raw files (even
|
serialized by key, and ``ZoneInfo`` objects constructed from raw files (even
|
||||||
those with a value for ``key`` specified) cannot be pickled.
|
those with a value for ``key`` specified) cannot be pickled.
|
||||||
|
|
||||||
The behavior of a ``ZoneInfo`` file depends on how it was constructed:
|
The behavior of a ``ZoneInfo`` object depends on how it was constructed:
|
||||||
|
|
||||||
1. ``ZoneInfo(key)``: When constructed with the primary constructor, a
|
1. ``ZoneInfo(key)``: When constructed with the primary constructor, a
|
||||||
``ZoneInfo`` object will be serialized by key, and when deserialized the
|
``ZoneInfo`` object will be serialized by key, and when deserialized the
|
||||||
|
@ -701,7 +701,7 @@ implementation in ways that may not be compatible with a non-ICU-based
|
||||||
implementation — particularly around the behavior of the cache.
|
implementation — particularly around the behavior of the cache.
|
||||||
|
|
||||||
Since it seems like ICU cannot be used as simply an additional data source for
|
Since it seems like ICU cannot be used as simply an additional data source for
|
||||||
``ZoneInfo`` files, this PEP considers the ICU support to be out of scope, and
|
``ZoneInfo`` objects, this PEP considers the ICU support to be out of scope, and
|
||||||
probably better supported by a third-party library.
|
probably better supported by a third-party library.
|
||||||
|
|
||||||
Alternative environment variable configurations
|
Alternative environment variable configurations
|
||||||
|
@ -846,7 +846,7 @@ Footnotes
|
||||||
but user support mostly focuses on these three types.
|
but user support mostly focuses on these three types.
|
||||||
|
|
||||||
.. [b]
|
.. [b]
|
||||||
The statement that identically constructed ``ZoneInfo`` files should be
|
The statement that identically constructed ``ZoneInfo`` objects should be
|
||||||
identical objects may be violated if the user deliberately clears the time
|
identical objects may be violated if the user deliberately clears the time
|
||||||
zone cache.
|
zone cache.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue