Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add clarification of the r string modifier#9571

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
tedsecretsource wants to merge1 commit intopylint-dev:main
base:main
Choose a base branch
Loading
fromtedsecretsource:patch-1

Conversation

tedsecretsource
Copy link

Raw sting literals may not be easily understood based on the brief description. This description is much more verbose (maybe too verbose) but should help the novice python programmer understand what the r modifier is and how / when to use it.

Type of Changes

Type
📜 Docs

Description

Added a more verbose description of the r (raw string literal) modifier for the novices like me…

Raw sting literals may not be easily understood based on the brief description. This description is much more verbose (maybe too verbose) but should help the novice python programmer understand what the r modifier is and how / when to use it.
Copy link
Member

@Pierre-SassoulasPierre-Sassoulas 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 for contributing to pylint and for making the doc better. I feel like this is way too verbose, It should be a sentence for each solution, maybe in a comment in the "good" example. We can add a link to a very detailed tutorial in "related.rst" however.

@Pierre-SassoulasPierre-Sassoulas added Documentation 📗 Skip news 🔇This change does not require a changelog entry labelsApr 28, 2024
@UlrichEckhardt
Copy link
Contributor

I like the idea, but have some suggestions how to improve it:

  • There is a bit of inconsistent spelling, sometimes it's "Python", sometimes "python" instead.
  • I understand the issue, but if I didn't I wouldn't understand the reference to regular expressions. Make that three paragraphs, one for how escape sequences in strings work, one that explains how to use either raw strings or double backslashes and the third explaining why this is particularly useful for regular expressions.
  • "and not to modify it" -> "and not to interpret backslashes as escape characters" (Python strings are immutable already)

@tedsecretsource
Copy link
Author

Hi@Pierre-Sassoulas. Thanks for the feedback. I am brand new to this project so not sure how to add the link to related.rst. If you can provide an example, I'll give this another try.

My intention with this PR is to try and clarify, or encourage, the use of ther string modifier because, I believe, it probably should be used in the majority of cases.

How about this:Use raw string literals (prefix with 'r') or double backslashes (\\) in Python to avoid escape sequence issues in regex. Example: r"\." or "\\." for a literal dot character.

To me it's only barely better.

@UlrichEckhardt Excellent feedback. Thank you. Let's see if we can get the initial sentence right and then add details to related.rst

Looking forward to your replies.

JeromeGill reacted with thumbs up emoji

@DanielNoord
Copy link
Collaborator

I agree that this is a bit too verbose for our documentation. We're not trying to explain all of Python, there are excellent resources for that on the internet.

tedsecretsource reacted with thumbs up emoji

@Pierre-Sassoulas
Copy link
Member

not sure how to add the link to related.rst.

Hey, you can create a file called "doc/data/messages/a/anomalous-backslash-in-string/related.rst", look at other related.rst in the repo for examples :)

@DanielNoordDanielNoord added the Needs take over 🛎️Orignal implementer went away but the code could be salvaged. labelMar 30, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@Pierre-SassoulasPierre-SassoulasPierre-Sassoulas requested changes

Requested changes must be addressed to merge this pull request.

Assignees
No one assigned
Labels
Documentation 📗Needs take over 🛎️Orignal implementer went away but the code could be salvaged.Skip news 🔇This change does not require a changelog entryWork in progress
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@tedsecretsource@UlrichEckhardt@DanielNoord@Pierre-Sassoulas

[8]ページ先頭

©2009-2025 Movatter.jp