From fca8f4eb7bc064176671b520b41c274e4fae6019 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 14 Sep 2023 11:10:26 +0300 Subject: [PATCH] Use Python 3 print() functions in examples --- doc/usage/restructuredtext/directives.rst | 8 ++++---- doc/usage/restructuredtext/roles.rst | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/usage/restructuredtext/directives.rst b/doc/usage/restructuredtext/directives.rst index 1fd5b666272..6b23810c392 100644 --- a/doc/usage/restructuredtext/directives.rst +++ b/doc/usage/restructuredtext/directives.rst @@ -544,9 +544,9 @@ __ https://pygments.org/docs/lexers def some_function(): interesting = False - print 'This line is highlighted.' - print 'This one is not...' - print '...but this one is.' + print('This line is highlighted.') + print('This one is not...') + print('...but this one is.') .. versionadded:: 1.1 .. versionchanged:: 1.6.6 @@ -576,7 +576,7 @@ __ https://pygments.org/docs/lexers :caption: this.py :name: this-py - print 'Explicit is better than implicit.' + print('Explicit is better than implicit.') In order to cross-reference a code-block using either the :rst:role:`ref` or the :rst:role:`numref` role, it is necessary diff --git a/doc/usage/restructuredtext/roles.rst b/doc/usage/restructuredtext/roles.rst index e468de9c244..7d2c57a2e78 100644 --- a/doc/usage/restructuredtext/roles.rst +++ b/doc/usage/restructuredtext/roles.rst @@ -468,8 +468,8 @@ different style: A piece of literal text, such as code. Within the contents, you can use curly braces to indicate a "variable" part, as in :rst:role:`file`. For - example, in ``:samp:`print 1+{variable}```, the part ``variable`` would be - emphasized: :samp:`print 1+{variable}` + example, in ``:samp:`print(1+{variable})```, the part ``variable`` would be + emphasized: :samp:`print(1+{variable})` If you don't need the "variable part" indication, use the standard :rst:role:`code` role instead.