◐ Shell
clean mode source ↗

bpo-31803: Remove time.clock() by vstinner · Pull Request #4018 · python/cpython

@vstinner

  • Remove time.clock() function
  • time.get_clock_info() doesn't accept 'clock' anymore
  • Document the removal in What's New in Python 3.7
  • Replace time.clock() with time.perf_counter() in the profile
    module, in turtledemo, and in ctypes tests.

https://bugs.python.org/issue31803

* Remove time.clock() function
* time.get_clock_info() doesn't accept 'clock' anymore
* Document the removal in What's New in Python 3.7
* Replace time.clock() with time.perf_counter() in the profile
  module, in turtledemo, and in ctypes tests.
This option wasn't implemented, documented, nor tested.

dianaclarke


.. versionadded:: 3.3
.. versionchanged:: 3.7
``'clock'`` is no more accepted since ``time.clock()`` was removed.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/no more/no longer

----

The ``time.clock()`` function has been removed, it was deprecated since Python
3.3. The function was not portable: on Windows it mesured wall-clock, whereas

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps replace:

it was deprecated since Python 3.3.

with:

as it has been deprecated since Python 3.3.

----

The ``time.clock()`` function has been removed, it was deprecated since Python
3.3. The function was not portable: on Windows it mesured wall-clock, whereas

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/mesured/measured

The ``time.clock()`` function has been removed, it was deprecated since Python
3.3. The function was not portable: on Windows it mesured wall-clock, whereas
it measured CPU time on Unix. Python provides better defined clocks with better
resolution since Python 3.3: use :func:`time.perf_counter` or

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps change:

Python provides better defined clocks with better resolution since Python 3.3

to:

Python has provided other clocks with better resolution since Python 3.3

@vstinner

I merged my PR #4020 which emits a deprecation warning. Let's wait for Pyhon 3.8 to remove time.clock(). I abandon this PR.

@vstinner