Skip to content

Commit 42d1320

Browse files
committed
merge from 3.2
2 parents 87e59cd + 023c6f7 commit 42d1320

1 file changed

Lines changed: 20 additions & 18 deletions

File tree

Doc/library/datetime.rst

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ miles, or mass. Naive :class:`datetime` objects are easy to understand and to
2525
work with, at the cost of ignoring some aspects of reality.
2626

2727
For applications requiring more, :class:`datetime` and :class:`time` objects
28-
have an optional time zone information attribute, :attr:`tzinfo`, that can contain
29-
an instance of a subclass of the abstract :class:`tzinfo` class. These
28+
have an optional time zone information attribute, :attr:`tzinfo`, that can be
29+
set to an instance of a subclass of the abstract :class:`tzinfo` class. These
3030
:class:`tzinfo` objects capture information about the offset from UTC time, the
3131
time zone name, and whether Daylight Saving Time is in effect. Note that only
3232
one concrete :class:`tzinfo` class, the :class:`timezone` class, is supplied by the
@@ -748,11 +748,13 @@ Other constructors, all class methods:
748748

749749
.. classmethod:: datetime.combine(date, time)
750750

751-
Return a new :class:`datetime` object whose date attributes are equal to the
752-
given :class:`date` object's, and whose time and :attr:`tzinfo` attributes are
753-
equal to the given :class:`time` object's. For any :class:`datetime` object
754-
*d*, ``d == datetime.combine(d.date(), d.timetz())``. If date is a
755-
:class:`datetime` object, its time and :attr:`tzinfo` attributes are ignored.
751+
Return a new :class:`datetime` object whose date components are equal to the
752+
given :class:`date` object's, and whose time components and :attr:`tzinfo`
753+
attributes are equal to the given :class:`time` object's. For any
754+
:class:`datetime` object *d*,
755+
``d == datetime.combine(d.date(), d.timetz())``. If date is a
756+
:class:`datetime` object, its time components and :attr:`tzinfo` attributes
757+
are ignored.
756758

757759

758760
.. classmethod:: datetime.strptime(date_string, format)
@@ -924,13 +926,13 @@ Instance methods:
924926
Return a datetime with the same attributes, except for those attributes given
925927
new values by whichever keyword arguments are specified. Note that
926928
``tzinfo=None`` can be specified to create a naive datetime from an aware
927-
datetime with no conversion of date and time attributes.
929+
datetime with no conversion of date and time data.
928930

929931

930932
.. method:: datetime.astimezone(tz)
931933

932934
Return a :class:`datetime` object with new :attr:`tzinfo` attribute *tz*,
933-
adjusting the date and time attributes so the result is the same UTC time as
935+
adjusting the date and time data so the result is the same UTC time as
934936
*self*, but in *tz*'s local time.
935937

936938
*tz* must be an instance of a :class:`tzinfo` subclass, and its
@@ -939,18 +941,18 @@ Instance methods:
939941
not return ``None``).
940942

941943
If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no
942-
adjustment of date or time attributes is performed. Else the result is local
944+
adjustment of date or time data is performed. Else the result is local
943945
time in time zone *tz*, representing the same UTC time as *self*: after
944946
``astz = dt.astimezone(tz)``, ``astz - astz.utcoffset()`` will usually have
945-
the same date and time attributes as ``dt - dt.utcoffset()``. The discussion
947+
the same date and time data as ``dt - dt.utcoffset()``. The discussion
946948
of class :class:`tzinfo` explains the cases at Daylight Saving Time transition
947949
boundaries where this cannot be achieved (an issue only if *tz* models both
948950
standard and daylight time).
949951

950952
If you merely want to attach a time zone object *tz* to a datetime *dt* without
951-
adjustment of date and time attributes, use ``dt.replace(tzinfo=tz)``. If you
953+
adjustment of date and time data, use ``dt.replace(tzinfo=tz)``. If you
952954
merely want to remove the time zone object from an aware datetime *dt* without
953-
conversion of date and time attributes, use ``dt.replace(tzinfo=None)``.
955+
conversion of date and time data, use ``dt.replace(tzinfo=None)``.
954956

955957
Note that the default :meth:`tzinfo.fromutc` method can be overridden in a
956958
:class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`.
@@ -1286,7 +1288,7 @@ Instance methods:
12861288
Return a :class:`time` with the same value, except for those attributes given
12871289
new values by whichever keyword arguments are specified. Note that
12881290
``tzinfo=None`` can be specified to create a naive :class:`time` from an
1289-
aware :class:`time`, without conversion of the time attributes.
1291+
aware :class:`time`, without conversion of the time data.
12901292

12911293

12921294
.. method:: time.isoformat()
@@ -1493,10 +1495,10 @@ There is one more :class:`tzinfo` method that a subclass may wish to override:
14931495

14941496
.. method:: tzinfo.fromutc(dt)
14951497

1496-
This is called from the default :class:`datetime.astimezone()` implementation.
1497-
When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time
1498-
attributes are to be viewed as expressing a UTC time. The purpose of
1499-
:meth:`fromutc` is to adjust the date and time attributes, returning an
1498+
This is called from the default :class:`datetime.astimezone()`
1499+
implementation. When called from that, ``dt.tzinfo`` is *self*, and *dt*'s
1500+
date and time data are to be viewed as expressing a UTC time. The purpose
1501+
of :meth:`fromutc` is to adjust the date and time data, returning an
15001502
equivalent datetime in *self*'s local time.
15011503

15021504
Most :class:`tzinfo` subclasses should be able to inherit the default

0 commit comments

Comments
 (0)