Skip to content
Merged
11 changes: 6 additions & 5 deletions Doc/tutorial/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,14 @@ and uses the ``j`` or ``J`` suffix to indicate the imaginary part

.. _tut-strings:

Strings
Texts
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd actually keep the heading Strings, because that's the correct name.

-------

Besides numbers, Python can also manipulate strings, which can be expressed
in several ways. They can be enclosed in single quotes (``'...'``) or
double quotes (``"..."``) with the same result [#]_. ``\`` can be used
to escape quotes::
Different kinds of text have the type :class:`str`. This includes
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest:

Python can manipulate text ("strings") as well as numbers. This can include [your list of examples].

Strings are enclosed [...].

characters "``!``", words "``rabbit``", names "``Paris``", sentences
"``Got your back.``", etc. "``Yay! :)``". They can be enclosed in single
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps add:

Even "123" is a string (and not a number - because it's enclosed in quotes.

quotes (``'...'``) or double quotes (``"..."``) with the same result [#]_.
``\`` can be used to escape quotes::
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the concept of escaping (and the word) is not familiar to many beginners, so I'd suggest something like:

To quote a quote, we need to "escape" it, by preceding it with \::


>>> 'spam eggs' # single quotes
'spam eggs'
Expand Down