Skip to content

bpo-27200: fix faq/programming and datetime #401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 18, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import sys, os, time
sys.path.append(os.path.abspath('tools/extensions'))
sys.path.append(os.path.abspath('includes'))

# General configuration
# ---------------------
Expand Down
4 changes: 2 additions & 2 deletions Doc/faq/programming.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1849,7 +1849,7 @@ containing statements like ::
will continue to work with the old version of the imported objects. If the
module contains class definitions, existing class instances will *not* be
updated to use the new class definition. This can result in the following
paradoxical behaviour:
paradoxical behaviour::

>>> import importlib
>>> import cls
Expand All @@ -1860,7 +1860,7 @@ paradoxical behaviour:
False

The nature of the problem is made clear if you print out the "identity" of the
class objects:
class objects::

>>> hex(id(c.__class__))
'0x7352a0'
Expand Down
File renamed without changes.
10 changes: 7 additions & 3 deletions Doc/library/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ Instance methods:


>>> from datetime import datetime
>>> datetime.now().isoformat(timespec='minutes')
>>> datetime.now().isoformat(timespec='minutes') # doctest: +SKIP
'2002-12-25T00:00'
>>> dt = datetime(2015, 1, 1, 12, 30, 59, 0)
>>> dt.isoformat(timespec='microseconds')
Expand Down Expand Up @@ -1781,9 +1781,11 @@ There is one more :class:`tzinfo` method that a subclass may wish to override:
else:
return dt

Example :class:`tzinfo` classes:
In the following :download:`tzinfo_examples.py
<../includes/tzinfo_examples.py>` file there are some examples of
:class:`tzinfo` classes:

.. literalinclude:: ../includes/tzinfo-examples.py
.. literalinclude:: ../includes/tzinfo_examples.py

Note that there are unavoidable subtleties twice per year in a :class:`tzinfo`
subclass accounting for both standard and daylight time, at the DST transition
Expand All @@ -1804,6 +1806,8 @@ When DST starts (the "start" line), the local wall clock leaps from 1:59 to
``astimezone(Eastern)`` won't deliver a result with ``hour == 2`` on the day DST
begins. For example, at the Spring forward transition of 2016, we get

>>> from datetime import datetime, timezone
>>> from tzinfo_examples import HOUR, Eastern
>>> u0 = datetime(2016, 3, 13, 5, tzinfo=timezone.utc)
>>> for i in range(4):
... u = u0 + i*HOUR
Expand Down