[issue35095] Implement pathlib.Path.append_bytes and pathlib.Path.append_text
Keelung Yang added the comment: @pitrou Firstly, I can't agree with `it is quite uncommon to open a file in append mode`. It should be depended to users and their application scenes. @pablogsal Secondly, I think `Path.write_*(, append=False)` is better then adding new APIs, as discussed in https://stackoverflow.com/questions/57296168/pathlib-path-write-text-in-append-mode -- nosy: +keelung-yang ___ Python tracker <https://bugs.python.org/issue35095> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()
New submission from Keelung Yang : 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 <https://bugs.python.org/issue46554> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()
Change by Keelung Yang : -- components: +Library (Lib) type: -> enhancement versions: +Python 3.11 ___ Python tracker <https://bugs.python.org/issue46554> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()
Keelung Yang added the comment: @barneygale, This is for simplifying code and improve readability, since `Readability counts` in The Zen of Python. Users needn't two lines code to append a file. And there is a minimal modifying to reach it. If inexperienced users are falling into the hole, just let them in and then learned sth. Because they will go out of the hole sooner or later. And finally, two lines cann't prevent them from falling into the hole. -- ___ Python tracker <https://bugs.python.org/issue46554> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()
Keelung Yang added the comment: This shouldn't be limited logging. In unstable application scene, file should be append and then close immediately to avoid breaking filesystem (e.g. inode is not updated timely). Such as main.py file in MicroPython development board, user may disconnect USB or press reset at anytime without ejecting disk. Or in IVI system, some embedded devices, record should be appended immediately. And if path.write(append=) is not common enough, then what's about built-in function open()? What's the purpose of adding read/write functions to pathlib.Path? -- ___ Python tracker <https://bugs.python.org/issue46554> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()
Keelung Yang added the comment: In file operations, write/modify/append, which one is generic/common? They're all. Modifying need more then one line code, but write/oppend needn't. Two lines are bad to readability and readability counts. How do you determine it's not common enough? There're many kind of users and application scene, and this feature is even not existed. Should we create a poll both to Python developers and it's users? -- ___ Python tracker <https://bugs.python.org/issue46554> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()
Keelung Yang added the comment: Without append kwarg, users need two lines to append. It's bad to both readability and writability. Library developers should focus on bath language and library's design targets, but how frequently used. And as all discussed here, at least one applications scene(logging) benefited from append kwarg. Right? -- ___ Python tracker <https://bugs.python.org/issue46554> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()
Keelung Yang added the comment: OK. Since most are opposed to append kwarg, I close this issue. Thanks ALL! -- resolution: -> wont fix stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46554> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35228] Index search in CHM help crashes viewer
Keelung Yang added the comment: It's reoccurable in Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on windows version 10.0.19041.264 Just need to open "Python 3.8 Manuals (64-bit)" --> index --> input 'p' on keyboard. -- nosy: +Keelung Yang ___ Python tracker <https://bugs.python.org/issue35228> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com