On 2021-07-13 15:18, Eric V. Smith wrote:
On 7/13/2021 9:52 AM, Thomas Güttler wrote:
Am Di., 13. Juli 2021 um 15:02 Uhr schrieb <[email protected]
<mailto:[email protected]>>:
Right now, writelines is a very big misnomer to many python
developers, especially beginners who would expect writelines to
put new lines at the end of every element in the list
My suggestion is to have either a writelines2 or a newline kwarg
which does put new lines automatically at the end of every line
written
I like the idea of having a kwarg for writelines
<https://docs.python.org/3/library/io.html#io.IOBase.writelines>.
Do you want a boolean like "append_newlines=True" or a string like
"append_string='\n'"
But it only applies if the argument is iterable, right?
That is, it would have no effect on something like:
fl.writelines(3, append_newlines=True)
That raises an exception, and I wouldn't expect that to change.
Assuming so, the parameter would need to have some more appropriate
name, like append_newlines_if_iterable.
Personally, I don't think this has any chance of being accepted, but
that's me. There are numerous ways to achieve this already, and we don't
need another one.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/MFCBTDEOQAF33APIVHSRTQ7AYR5HF2YH/
Code of Conduct: http://python.org/psf/codeofconduct/