Ignore me on this, I wasn't focusing on the function at hand.

Eric

On 7/13/2021 10:18 AM, 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 <sandhoners123@gmail.com>:
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.

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)

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.

Eric


_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/OTRRFIP4SVN6BF43ARLO43DNVDBCMZXI/
Code of Conduct: http://python.org/psf/codeofconduct/
-- 
Eric V. Smith