Skip to content

Update documents.rst #1514

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ibrahim-ogunbiyi
Copy link

I think it's best to replace StringIO with BytesIO since we are working with bytes. This ensures that beginners, or anyone skimming the documentation and copying code, end up with correct and functional code.

I think it's best to replace `StringIO` with `BytesIO` since we are working with bytes. This ensures that beginners, or anyone skimming the documentation and copying code, end up with correct and functional code.
@@ -78,11 +78,11 @@ a document like so::
# or

with open('foobar.docx', 'rb') as f:
source_stream = StringIO(f.read())
source_stream = BytesIO(f.read())
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, interesting. I'm sure this is an artifact of this documentation being written during the Python 2 era, when StringIO actually meant "read bytes".

I'll put it on the shortlist and fix it up next time I'm in there.

@ibrahim-ogunbiyi
Copy link
Author

Alright noted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants