Skip to content
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

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

Conversation

TommyUnreal
Copy link
Contributor

@TommyUnreal TommyUnreal commented Jul 23, 2023

While the term "string" is well-known in computer science, it might not resonate with beginners or non-technical individuals. Term Texts emphasize practical application in a similar way to Numbers and Lists chapters. This can make the introduction part less intimidating and more beginner-oriented. On the other hand, people coming from other technologies will not be surprised that text is represented with strings.


📚 Documentation preview 📚: https://cpython-previews--107104.org.readthedocs.build/

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.
@@ -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.

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
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 \::

to escape quotes::
Different kinds of text have the type :class:`str`. This includes
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.

Changed the description, removed duplicate explanations and reworked
examples so they are more consice with its paragraph.
@TommyUnreal TommyUnreal requested a review from evildmp July 23, 2023 11:54
strings are equivalent. The string is enclosed in double quotes if
the string contains a single quote and no double quotes, otherwise it is
enclosed in single quotes. The :func:`print` function produces a more
In the interactive interpreter, the string definition and output string
Copy link
Contributor

Choose a reason for hiding this comment

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

"In the Python shell..."

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

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

Some minor suggestions, thanks for the PR!

Doc/tutorial/introduction.rst Outdated Show resolved Hide resolved
Doc/tutorial/introduction.rst Outdated Show resolved Hide resolved
Doc/tutorial/introduction.rst Outdated Show resolved Hide resolved
Doc/tutorial/introduction.rst Outdated Show resolved Hide resolved
@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@hugovk hugovk added needs backport to 3.11 only security fixes needs backport to 3.12 bug and security fixes labels Jul 23, 2023
TommyUnreal and others added 3 commits July 23, 2023 22:10
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
@TommyUnreal
Copy link
Contributor Author

Some minor suggestions, thanks for the PR!

Thank you for the feedback!

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

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

Thank you!

@hugovk hugovk enabled auto-merge (squash) July 24, 2023 05:55
@hugovk hugovk merged commit 2cf9902 into python:main Jul 24, 2023
@miss-islington
Copy link
Contributor

Thanks @TommyUnreal for the PR, and @hugovk for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-107167 is a backport of this pull request to the 3.12 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 24, 2023
…chapter. (pythonGH-107104)

(cherry picked from commit 2cf9902)

Co-authored-by: TommyUnreal <45427816+TommyUnreal@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
@bedevere-bot bedevere-bot removed the needs backport to 3.12 bug and security fixes label Jul 24, 2023
@bedevere-bot
Copy link

GH-107168 is a backport of this pull request to the 3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 24, 2023
…chapter. (pythonGH-107104)

(cherry picked from commit 2cf9902)

Co-authored-by: TommyUnreal <45427816+TommyUnreal@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Jul 24, 2023
hugovk added a commit that referenced this pull request Jul 24, 2023
… chapter. (GH-107104) (#107167)

Co-authored-by: TommyUnreal <45427816+TommyUnreal@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
hugovk added a commit that referenced this pull request Jul 24, 2023
… chapter. (GH-107104) (#107168)

Co-authored-by: TommyUnreal <45427816+TommyUnreal@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
carljm added a commit to carljm/cpython that referenced this pull request Jul 24, 2023
* main: (73 commits)
  Thoroughly refactor the cases generator (python#107151)
  Docs: Add missing markup to Argument Clinic docs (python#106876)
  pythongh-107162: Document errcode.h usage in its comment (python#107177)
  pythongh-106320: Remove private _PyDict C API (python#107145)
  Fix PyVectorcall_Function doc versionadded (python#107140)
  Docs: Remove duplicate word in Argument Clinic howto heading (python#107169)
  pythongh-107017: Change Chapter Strings to Texts in the Introduction chapter. (python#107104)
  pythongh-106320: Remove private _PyObject C API (python#107159)
  Docs: fix typo in os.pwrite docstring (python#107087)
  pythongh-105291: Add link to migration guide for distutils (python#107130)
  pythongh-106948: Docs: Disable links for C standard library functions, OS utility functions and system calls (python#107062)
  pythongh-106320: Remove _PyBytes_Join() C API (python#107144)
  pythongh-106320: Remove private _PyObject C API (python#107147)
  pythongh-106320: Remove _PyTuple_MaybeUntrack() C API (python#107143)
  pythongh-106320: Remove _PyIsSelectable_fd() C API (python#107142)
  Remove superflous whitespaces in `layout.html`. (pythonGH-107067)
  pythongh-107122: Update what's news for dbm.*dbm.clear() method (pythongh-107135)
  pythongh-107122: Add clear method to dbm.ndbm module (pythongh-107126)
  pythongh-62519: Make pgettext search plurals when translation is not found (python#107118)
  pythongh-107122: Add clear method to dbm.gdbm.module (pythongh-107127)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants