From 6da2f88af0d32de24b84037716e7fb7baedd54a0 Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Wed, 2 Jan 2013 03:30:04 +0200 Subject: [PATCH] Fix grammar, whitespace, and a couple of semantic mistakes (#16818). --- pep-0431.txt | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/pep-0431.txt b/pep-0431.txt index 1d7044cee..2a8ff1e31 100644 --- a/pep-0431.txt +++ b/pep-0431.txt @@ -7,7 +7,7 @@ BDFL-Delegate: Barry Warsaw 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.