Fix grammar, whitespace, and a couple of semantic mistakes (#16818).

This commit is contained in:
Ezio Melotti 2013-01-02 03:30:04 +02:00
parent 924049ca71
commit 6da2f88af0
1 changed files with 20 additions and 19 deletions

View File

@ -7,7 +7,7 @@ BDFL-Delegate: Barry Warsaw <barry@python.org>
Status: Draft
Type: Standards Track
Content-Type: text/x-rst
Created: 11-Dec-2012
Created: 11-Dec-2012
Post-History: 11-Dec-2012
@ -49,14 +49,14 @@ for example Windows, a distribution containing the latest tz database should
also be available at the Python Package Index, so it can be easily installed
with the Python packaging tools such as ``easy_install`` or ``pip``. This
could also be done on Unices that are no longer receiving updates and
therefore has an outdated database.
therefore have an outdated database.
With such a mechanism Python would have full time zone support in the
standard library on most platforms, and a simple package installation would
provide time zone support on those platforms where the tz database isn't
included, such as Windows.
The time zone support will be implemented by a new module called `timezone``,
The time zone support will be implemented by a new module called ``timezone``,
based on Stuart Bishop's ``pytz`` module.
@ -82,12 +82,12 @@ The support for this will be made by integrating Lennart Regebro's
Ambiguous times
---------------
When changing over from daylight savings time the clock is turned back one
When changing over from daylight savings time (DST) the clock is turned back one
hour. This means that the times during that hour happens twice, once without
DST and then once with DST. Similarly, when changing to daylight savings
time, one hour goes missing.
The current time zone API can not differentiating between the two ambiguous
The current time zone API can not differentiate between the two ambiguous
times during a change from DST. For example, in Stockholm the time of
2012-11-28 02:00:00 happens twice, both at UTC 2012-11-28 00:00:00 and also
at 2012-11-28 01:00:00.
@ -124,25 +124,26 @@ function and one new exception.
This class provides a concrete implementation of the ``zoneinfo`` base
class that implements DST support.
* New function :``get_timezone(name=None, db=None)``
This function takes a name string that must be a string specifying a
valid zoneinfo timezone, i.e. "US/Eastern", "Europe/Warsaw" or "Etc/GMT+11".
If not given, the local timezone will be looked up. If an invalid zone name
are given, or the local timezone can not be retrieved, the function raises
is given, or the local timezone can not be retrieved, the function raises
`UnknownTimeZoneError`.
The function also takes an optional path to the location of the zoneinfo
database which should be used. If not specified, the function will check if
the `timezonedata` module is installed, and then use that location or
otherwise use the database in ``/usr/share/zoneinfo``.
If no database is found an ``UnknownTimeZoneError`` or subclass thereof will
be raised with a message explaining that no zoneinfo database can be found,
but that you can install one with the ``timezonedata`` package.
* New Exception: ``UnknownTimeZoneError``
This exception is raised when giving a time zone specification that can't be
@ -165,7 +166,7 @@ handle time ambiguity during DST changeovers.
* ``tzinfo.dst(self, dt, is_dst=True)``
* ``tzinfo.tzname(self, dt, is_dst=True)``
The ``is_dst`` parameter can be ``True`` (default), ``False``, or ``None``.
``True`` will specify that the given datetime should be interpreted as
@ -184,7 +185,7 @@ There are also two new exceptions:
* ``AmbiguousTimeError``
This exception is raised when giving a datetime specification that are
This exception is raised when giving a datetime specification that is
ambiguous while setting ``is_dst`` to None::
>>> datetime(2012, 11, 28, 2, 0, tzinfo=timezone('Europe/Stockholm'), is_dst=None)
@ -196,8 +197,8 @@ There are also two new exceptions:
* ``NonExistentTimeError``
This exception is raised when giving a datetime specification that are
ambiguous while setting ``is_dst`` to None::
This exception is raised when giving a datetime specification that is
non-existent while setting ``is_dst`` to None::
>>> datetime(2012, 3, 25, 2, 0, tzinfo=timezone('Europe/Stockholm'), is_dst=None)
>>>
@ -219,28 +220,28 @@ Differences from the ``pytz`` API
=================================
* ``pytz`` has the functions ``localize()`` and ``normalize()`` to work
around that ``tzinfo`` doesn't have is_dst. When ``is_dst`` is
around that ``tzinfo`` doesn't have is_dst. When ``is_dst`` is
implemented directly in ``datetime.tzinfo`` they are no longer needed.
* The ``pytz`` method ``timezone()`` is instead called ``get_timezone()`` for
clarity.
* ``get_timezone()`` will return the local time zone if called without
parameters.
arguments.
* The class ``pytz.StaticTzInfo`` is there to provide the ``is_dst`` support
for static timezones. When ``is_dst`` support is included in
``datetime.tzinfo`` it is no longer needed.
Discussion
==========
Should the windows installer include the data package?
------------------------------------------------------
It has been suggested that the Windows installer should include the data
package. This would mean that an explicit installation no longer would be
package. This would mean that an explicit installation would no longer be
needed on Windows. On the other hand, that would mean that many using Windows
would not be aware that the database quickly becomes outdated and would not
keep it updated.