Issue 36181: Add mode parameter to PurePath.write_text to allow for 'a' mode (original) (raw)

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 and adding a parameter append was also discussed as part of the original API . 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:12 admin set github: 80362
2019-03-04 14:06:26 serhiy.storchaka set status: open -> closedresolution: rejectedstage: resolved
2019-03-04 12:55:27 vinayluzrao set messages: +
2019-03-04 12:52:17 vinayluzrao set messages: +
2019-03-04 12:37:09 lys.nikolaou set nosy: + lys.nikolaoumessages: +
2019-03-04 12:28:38 xtreak set nosy: + xtreak, pitroumessages: +
2019-03-04 12:21:08 vinayluzrao create