8000 gh-85453: Improve variable mark up on datetime.rst by uatach · Pull Request #120702 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-85453: Improve variable mark up on datetime.rst #120702

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
Oct 14, 2024
Merged
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
34 changes: 17 additions & 17 deletions Doc/library/datetime.rst
90BD
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,19 @@ Objects of the :class:`date` type are always naive.

8000 An object of type :class:`.time` or :class:`.datetime` may be aware or naive.

A :class:`.datetime` object *d* is aware if both of the following hold:
A :class:`.datetime` object ``d`` is aware if both of the following hold:

1. ``d.tzinfo`` is not ``None``
2. ``d.tzinfo.utcoffset(d)`` does not return ``None``

Otherwise, *d* is naive.
Otherwise, ``d`` is naive.

A :class:`.time` object *t* is aware if both of the following hold:
A :class:`.time` object ``t`` is aware if both of the following hold:

1. ``t.tzinfo`` is not ``None``
2. ``t.tzinfo.utcoffset(None)`` does not return ``None``.

Otherwise, *t* is naive.
Otherwise, ``t`` is naive.

The distinction between aware and naive doesn't apply to :class:`timedelta`
objects.
Expand Down Expand Up @@ -338,8 +338,8 @@ Supported operations:
+--------------------------------+-----------------------------------------------+
| ``q, r = divmod(t1, t2)`` | Computes the quotient and the remainder: |
| | ``q = t1 // t2`` (3) and ``r = t1 % t2``. |
| | q is an integer and r is a :class:`timedelta` |
| | object. |
| | ``q`` is an integer and ``r`` is a |
| | :class:`timedelta` object. |
+--------------------------------+-----------------------------------------------+
| ``+t1`` | Returns a :class:`timedelta` object with the |
| | same value. (2) |
Expand Down Expand Up @@ -506,7 +506,7 @@ Other constructors, all class methods:
January 1 of year 1 has ordinal 1.

:exc:`ValueError` is raised unless ``1 <= ordinal <=
date.max.toordinal()``. For any date *d*,
date.max.toordinal()``. For any date ``d``,
``date.fromordinal(d.toordinal()) == d``.


Expand Down Expand Up @@ -677,7 +677,7 @@ Instance methods:
.. method:: date.toordinal()

Return the proleptic Gregorian ordinal of the date, where January 1 of year 1
has ordinal 1. For any :class:`date` object *d*,
has ordinal 1. For any :class:`date` object ``d``,
``date.fromordinal(d.toordinal()) == d``.


Expand Down Expand Up @@ -729,7 +729,7 @@ Instance methods:

.. method:: date.__str__()

For a date *d*, ``str(d)`` is equivalent to ``d.isoformat()``.
For a date ``d``, ``str(d)`` is equivalent to ``d.isoformat()``.


.. method:: date.ctime()
Expand Down Expand Up @@ -1006,7 +1006,7 @@ Other constructors, all class methods:
is used. If the *date* argument is a :class:`.datetime` object, its time components
and :attr:`.tzinfo` attributes are ignored.

For any :class:`.datetime` object *d*,
For any :class:`.datetime` object ``d``,
``d == datetime.combine(d.date(), d.time(), d.tzinfo)``.

.. versionchanged:: 3.6
Expand Down Expand Up @@ -1213,11 +1213,11 @@ Supported operations:

If both are naive, or both are aware and have the same :attr:`~.datetime.tzinfo` attribute,
the :attr:`~.datetime.tzinfo` attributes are ignored, and the result is a :class:`timedelta`
object *t* such that ``datetime2 + t == datetime1``. No time zone adjustments
object ``t`` such that ``datetime2 + t == datetime1``. No time zone adjustments
are done in this case.

If both are aware and have different :attr:`~.datetime.tzinfo` attributes, ``a-b`` acts
as if *a* and *b* were first converted to naive UTC datetimes. The
as if ``a`` and ``b`` were first converted to naive UTC datetimes. The
result is ``(a.replace(tzinfo=None) - a.utcoffset()) - (b.replace(tzinfo=None)
- b.utcoffset())`` except that the implementation never overflows.

Expand Down Expand Up @@ -1397,11 +1397,11 @@ Instance methods:

.. method:: datetime.utctimetuple()

If :class:`.datetime` instance *d* is naive, this is the same as
If :class:`.datetime` instance ``d`` is naive, this is the same as
``d.timetuple()`` except that :attr:`~.time.struct_time.tm_isdst` is forced to 0 regardless of what
``d.dst()`` returns. DST is never in effect for a UTC time.

If *d* is aware, *d* is normalized to UTC time, by subtracting
If ``d`` is aware, ``d`` is normalized to UTC time, by subtracting
``d.utcoffset()``, and a :class:`time.struct_time` for the
normalized time is returned. :attr:`!tm_isdst` is forced to 0. Note
that an :exc:`OverflowError` may be raised if ``d.year`` was
Expand Down Expand Up @@ -1549,7 +1549,7 @@ Instance methods:

.. method:: datetime.__str__()

For a :class:`.datetime` instance *d*, ``str(d)`` is equivalent to
For a :class:`.datetime` instance ``d``, ``str(d)`` is equivalent to
``d.isoformat(' ')``.


Expand Down Expand Up @@ -1796,7 +1796,7 @@ Instance attributes (read-only):
.. versionadded:: 3.6

:class:`.time` objects support equality and order comparisons,
where *a* is considered less than *b* when *a* precedes *b* in time.
where ``a`` is considered less than ``b`` when ``a`` precedes ``b`` in time.

Naive and aware :class:`!time` objects are never equal.
Order comparison between naive and aware :class:`!time` objects raises
Expand Down Expand Up @@ -1927,7 +1927,7 @@ Instance methods:

.. method:: time.__str__()

For a time *t*, ``str(t)`` is equivalent to ``t.isoformat()``.
For a time ``t``, ``str(t)`` is equivalent to ``t.isoformat()``.


.. method:: time.strftime(format)
Expand Down
Loading
0