diff options
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/datetime.rst | 17 | ||||
-rw-r--r-- | Doc/library/multiprocessing.rst | 10 | ||||
-rw-r--r-- | Doc/library/urllib.request.rst | 2 |
3 files changed, 16 insertions, 13 deletions
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index 5899ba7..456c1a0 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -455,7 +455,9 @@ Instance methods: Return a :class:`time.struct_time` such as returned by :func:`time.localtime`. The hours, minutes and seconds are 0, and the DST flag is -1. ``d.timetuple()`` is equivalent to ``time.struct_time((d.year, d.month, d.day, 0, 0, 0, - d.weekday(), d.toordinal() - date(d.year, 1, 1).toordinal() + 1, -1))`` + d.weekday(), yday, -1))``, where ``yday = d.toordinal() - date(d.year, 1, + 1).toordinal() + 1`` is the day number within the current year starting with + ``1`` for January 1st. .. method:: date.toordinal() @@ -919,12 +921,13 @@ Instance methods: Return a :class:`time.struct_time` such as returned by :func:`time.localtime`. ``d.timetuple()`` is equivalent to ``time.struct_time((d.year, d.month, d.day, - d.hour, d.minute, d.second, d.weekday(), d.toordinal() - date(d.year, 1, - 1).toordinal() + 1, dst))`` The :attr:`tm_isdst` flag of the result is set - according to the :meth:`dst` method: :attr:`tzinfo` is ``None`` or :meth:`dst` - returns ``None``, :attr:`tm_isdst` is set to ``-1``; else if :meth:`dst` - returns a non-zero value, :attr:`tm_isdst` is set to ``1``; else ``tm_isdst`` is - set to ``0``. + d.hour, d.minute, d.second, d.weekday(), yday, dst))``, where ``yday = + d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the day number within + the current year starting with ``1`` for January 1st. The :attr:`tm_isdst` flag + of the result is set according to the :meth:`dst` method: :attr:`tzinfo` is + ``None`` or :meth:`dst`` returns ``None``, :attr:`tm_isdst` is set to ``-1``; + else if :meth:`dst` returns a non-zero value, :attr:`tm_isdst` is set to ``1``; + else ``tm_isdst`` is set to ``0``. .. method:: datetime.utctimetuple() diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index 85a8241..7fbb258 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -61,15 +61,15 @@ object and then calling its :meth:`~Process.start` method. :class:`Process` follows the API of :class:`threading.Thread`. A trivial example of a multiprocess program is :: - from multiprocessing import Process + from multiprocessing import Process def f(name): print('hello', name) - if __name__ == '__main__': - p = Process(target=f, args=('bob',)) - p.start() - p.join() + if __name__ == '__main__': + p = Process(target=f, args=('bob',)) + p.start() + p.join() To show the individual process IDs involved, here is an expanded example:: diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index c4a8a79..1278434 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1058,7 +1058,7 @@ Examples -------- This example gets the python.org main page and displays the first 300 bytes of -it.:: +it. :: >>> import urllib.request >>> f = urllib.request.urlopen('http://www.python.org/') |