-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-46209: add documentation for decoding newlines in the io module
#30308
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
base: main
Are you sure you want to change the base?
Conversation
Doc/library/io.rst
Outdated
| .. attribute:: newlines | ||
|
|
||
| a tuple of types of newlines encountered, or the newline if only | ||
| one type of newline is found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The types are not clear here. Are you saying this is a tuple of strings or one string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the type is either a string or tuple of strings
Lines 1971 to 1980 in e18d815
| def newlines(self): | |
| return (None, | |
| "\n", | |
| "\r", | |
| ("\r", "\n"), | |
| "\r\n", | |
| ("\n", "\r\n"), | |
| ("\r", "\r\n"), | |
| ("\r", "\n", "\r\n") | |
| )[self.seennl] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok! I wouldn’t say types of newlines, unless that phrase is used elsewhere in the docs, it could be confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about changing to representations of newlines?
Line 1901 in e18d815
| records the types of newlines encountered. When used with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds a bit abstract to me. These are newlines, meaning strings.
Isn’t there an existing phrase in io docs or dosctrings that can be reused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't find any in the io docs, The docstring of that class says types of newlines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth just giving some examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Listed all the possible values.
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Éric <merwok@netwok.org>
list all possible values of an attribute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs complied on my machine. Looks ok.
https://bugs.python.org/issue46209