On Tue, Jul 13, 2021 at 9:00 AM <2QdxY4RzWzUUiLuE@potatochowder.com> wrote:
As it stands, writelines is consistent with readlines.  Both preserve
newlines.

indeed. so if this idea is to be done (and there's something to be said for it), I think a similar option should be added to readlines as well -- striping the newline.

A couple other notes:

This would highlight the whole "a string is an iterable of strings" problem :-( -- should strings be special cased? I think not, that's an issue that Python programmers have to learn at one point or another anyway.

As for whether it always puts in a newline, or if you can specify what you want to put in , I vote for the newline -- newlines are not the same on all platforms (though TextIO does translate), but I think it would get a bit confusing if someone explicitly put in "\n| and got "\r\n".

And the name IS writeLINES -- so why would anyone expect to use it for anything else -- we still have str.join() after all.

-CHB
-- 
Christopher Barker, PhD (Chris)

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython