◐ Shell
reader mode source ↗
Skip to content

Note regarding + mode truncation applies to both text and binary mode#11314

Merged
DinoV merged 4 commits into
python:masterfrom
andresdelfino:open-update-mode
Sep 10, 2019
Merged

Note regarding + mode truncation applies to both text and binary mode#11314
DinoV merged 4 commits into
python:masterfrom
andresdelfino:open-update-mode

Conversation

@andresdelfino

Copy link
Copy Markdown
Contributor

Text mode works exactly the same as binary mode for updating (w+/r+ vs w+b/r+b):

testfile = 'testfile'

with open(testfile, 'w') as file:
    file.write('A')

with open(testfile, 'r+') as file:
    file_content = file.read()
    print('Content:', file_content)

with open(testfile, 'w+') as file:
    file_content = file.read()
    print('Content:', file_content)

@remilapeyre remilapeyre left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hide comment

Thanks!

@DinoV DinoV merged commit c1d8c1c into python:master Sep 10, 2019
@bedevere-bot

Copy link
Copy Markdown

@DinoV: Please replace # with GH- in the commit message next time. Thanks!

@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @andresdelfino for the PR, and @DinoV for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 10, 2019
…pythonGH-11314)

* Improve doc on open's mode +

* Improve wording

* Address comment from Rémi
(cherry picked from commit c1d8c1c)

Co-authored-by: Andre Delfino <adelfino@gmail.com>
@bedevere-bot

Copy link
Copy Markdown

GH-15869 is a backport of this pull request to the 3.8 branch.

gpshead pushed a commit that referenced this pull request Sep 10, 2019
…GH-11314) (GH-15869)

* Improve doc on open's mode +

* Improve wording

* Address comment from Rémi
(cherry picked from commit c1d8c1c)

Co-authored-by: Andre Delfino <adelfino@gmail.com>
websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
python#11314)

* Improve doc on open's mode +

* Improve wording

* Address comment from Rémi
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 issue skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants