Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-101100: Fix most Sphinx nitpicks in the glossary andstdtypes.rst
#112757
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
The :meth:`!__or__` method for type objects was added to support the syntax | ||
``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may |
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 considered linking tohttps://docs.python.org/3/reference/datamodel.html#object.__or__, but the data model only discusses implementing__or__
in the context of emulating numeric types, and that's pretty distinct to the purpose oftype.__or__
@@ -383,7 +385,7 @@ Glossary | |||
file object | |||
An object exposing a file-oriented API (with methods such as | |||
:meth:`read()` or :meth:`write()`) to an underlying resource. Depending | |||
:meth:`!read` or :meth:`!write`) to an underlying resource. Depending |
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 can refer toio.BaseIO
.
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'm not sure there's anything we could specifically link to for either method.io.IOBase
does not haveread()
orwrite()
as abstract methods, so neitherIOBase.read
norIOBase.write
is explicitly documented currently.
https://docs.python.org/3/library/io.html#io.IOBase
Here's all theIOBase
docs say onread
andwrite
:
Even thoughIOBase does not declare read() or write() because their signatures will vary, implementations and clients should consider those methods part of the interface. Also, implementations may raise aValueError (orUnsupportedOperation) when operations they do not support are called.
Specific subclasses ofIOBase
implement versions ofread
andwrite
that either only work with raw binary streams or only work with text streams
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.
Well, and there is a reason to not declare them there. But there are many other references toread
andwrite
. It would be nice to have the general interface of them be documented somewhere. It is a different issue.
@@ -383,7 +385,7 @@ Glossary | |||
file object | |||
An object exposing a file-oriented API (with methods such as | |||
:meth:`read()` or :meth:`write()`) to an underlying resource. Depending | |||
:meth:`!read` or :meth:`!write`) to an underlying resource. Depending |
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.
Well, and there is a reason to not declare them there. But there are many other references toread
andwrite
. It would be nice to have the general interface of them be documented somewhere. It is a different issue.
Thanks@AlexWaygood for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
…es.rst` (pythonGH-112757)(cherry picked from commite3f670e)Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
GH-112789 is a backport of this pull request to the3.12 branch. |
…es.rst` (pythonGH-112757)(cherry picked from commite3f670e)Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
GH-112790 is a backport of this pull request to the3.11 branch. |
Uh oh!
There was an error while loading.Please reload this page.
This doesn't get rid of all the Sphinx warnings in either file (there are some tricky ones in both that I'd rather defer for now), but it gets rid of most in both.
📚 Documentation preview 📚:https://cpython-previews--112757.org.readthedocs.build/