diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-04-08 16:18:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-08 16:18:04 (GMT) |
commit | 46936d5a71d1683dbd8ddb6d7f39aab50ecfec50 (patch) | |
tree | 1f51e69c1fbb9401516478b8866d01f1513644cb /Doc/library/timeit.rst | |
parent | 9265dd72e5ec1cfa5fcdb5be8ebffe1d9994bd4b (diff) | |
download | cpython-46936d5a71d1683dbd8ddb6d7f39aab50ecfec50.zip cpython-46936d5a71d1683dbd8ddb6d7f39aab50ecfec50.tar.gz cpython-46936d5a71d1683dbd8ddb6d7f39aab50ecfec50.tar.bz2 |
Improve highlighting of some code blocks. (GH-6401)
Diffstat (limited to 'Doc/library/timeit.rst')
-rw-r--r-- | Doc/library/timeit.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst index 8bbadf1..d922fd6 100644 --- a/Doc/library/timeit.rst +++ b/Doc/library/timeit.rst @@ -25,7 +25,7 @@ Basic Examples The following example shows how the :ref:`timeit-command-line-interface` can be used to compare three different expressions: -.. code-block:: sh +.. code-block:: shell-session $ python3 -m timeit '"-".join(str(n) for n in range(100))' 10000 loops, best of 5: 30.2 usec per loop @@ -264,7 +264,7 @@ Examples It is possible to provide a setup statement that is executed only once at the beginning: -.. code-block:: sh +.. code-block:: shell-session $ python -m timeit -s 'text = "sample string"; char = "g"' 'char in text' 5000000 loops, best of 5: 0.0877 usec per loop @@ -293,7 +293,7 @@ The following examples show how to time expressions that contain multiple lines. Here we compare the cost of using :func:`hasattr` vs. :keyword:`try`/:keyword:`except` to test for missing and present object attributes: -.. code-block:: sh +.. code-block:: shell-session $ python -m timeit 'try:' ' str.__bool__' 'except AttributeError:' ' pass' 20000 loops, best of 5: 15.7 usec per loop |