This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add mode parameter to PurePath.write_text to allow for 'a' mode
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.8
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: lys.nikolaou, pitrou, vinayluzrao, xtreak
Priority: normal Keywords:

Created on 2019-03-04 12:21 by vinayluzrao, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (5)
msg337097 - (view) Author: Vinay Rao (vinayluzrao) Date: 2019-03-04 12:21
- Default should be 'w' for compatibility.

- There should be a check that makes sure mode is either 'w' or 'a', or else raise ValueError.
msg337098 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-03-04 12:28
append_text helper was proposed as part of issue35095 and adding a parameter append was also discussed as part of the original API issue20218 . Adding @pitrou to decide upon the API.
msg337099 - (view) Author: Lysandros Nikolaou (lys.nikolaou) * (Python committer) Date: 2019-03-04 12:37
Not that it makes a big difference, but write_text is a method of the Path class, not PurePath.
msg337102 - (view) Author: Vinay Rao (vinayluzrao) Date: 2019-03-04 12:52
Upon reading the issue threads linked by @xtreak, I have changed my mind and think this is a bad idea.
1) It adds more to maintain without offering much benefit (the use case of the shortcut is probably quite rare)
2) The argument 'mode' only accepting two options is probably a bit unintuitive, considering it typically accepts many others in other ocurrences of this type of functionality.
msg337103 - (view) Author: Vinay Rao (vinayluzrao) Date: 2019-03-04 12:55
Oh, and write_bytes would have to go thorough the same modification to make them consistent.
History
Date User Action Args
2022-04-11 14:59:12adminsetgithub: 80362
2019-03-04 14:06:26serhiy.storchakasetstatus: open -> closed
resolution: rejected
stage: resolved
2019-03-04 12:55:27vinayluzraosetmessages: + msg337103
2019-03-04 12:52:17vinayluzraosetmessages: + msg337102
2019-03-04 12:37:09lys.nikolaousetnosy: + lys.nikolaou
messages: + msg337099
2019-03-04 12:28:38xtreaksetnosy: + xtreak, pitrou
messages: + msg337098
2019-03-04 12:21:08vinayluzraocreate