[New-bugs-announce] [issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()

Keelung Yang report at bugs.python.org
Thu Jan 27 16:20:58 EST 2022


New submission from Keelung Yang <keelung_yang at 163.com>:

Three reasons to improve issue 35095: Implement pathlib.Path.append_bytes and pathlib.Path.append_text

1. If I want to append text to log at each startup(before calling basicConfig), there is no simple way to do this.

2. Adding append keyword is better then adding new APIs.

3. From stackoverflow: How does this make the classes clean? They already contain the write_* methods which are just not flexible enough. If the methods (or classes) are not dirty how would e.g. adding an optional parameter append=False to them make them dirty? https://stackoverflow.com/questions/57296168/pathlib-path-write-text-in-append-mode

So, this patch is just an implementation of discussions in above stackoverflow link.

----------
files: add-append-arg-to-path.write.patch
keywords: patch
messages: 411929
nosy: keelung-yang
priority: normal
severity: normal
status: open
title: Add append keyword argument to Path.write_text() and Path.write_bytes()
Added file: https://bugs.python.org/file50591/add-append-arg-to-path.write.patch

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46554>
_______________________________________


More information about the New-bugs-announce mailing list