8000 gh-107017: Change Chapter Strings to Texts in the Introduction chapter. by TommyUnreal · Pull Request #107104 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-107017: Change Chapter Strings to Texts in the Introduction chapter. #107104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Next Next commit
Change Strings to Texts in introduction chapter.
While term "string" is well known in computer science, it might not resonate with beginners or non-technical individuals. Term Texts emphasize practical application in similar way to Numbers and Lists chapters. This can make the introduction part less intimidating and more beginner-oriented. On the other hand people comming from other technologies will not be surprised that text is represented with strings.
  • Loading branch information
TommyUnreal committed Jul 23, 2023
commit 27bd6d5bacbd6d6b67808120586d78958a062ef6
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
0