On Tue, Jul 13, 2021 at 09:54:27AM -0400, Eric V. Smith wrote: > I'm skeptical that people who won't read the documentation for > writelines will either read the documentation for writelines2, or > intuitively understand how it's different from writelines, or would know > there's a kwarg parameter to writelines.
Of course they won't. They'll just go on Twitter to bitch about what a horrible language Python is, because it's not "intuitive", until somebody points them to a few dozen StackOverflow posts that point out how to use it correctly. *wink* In this case I agree that the current API is a little surprising, but it seems to me that adding a kw parameter or a new method is an easy way to solve that. No, people who don't read the docs won't intuit their existence, but so long as *one* person reads the docs, the knowledge will slowly spread via mailing lists, StackOverflow, code reviews, etc. > It seems your proposal would only matter if the argument were a list? writelines doesn't require a list, it takes any iterable that yields strings. (The docs are misleading: it still says "list".) The current behaviour would have to remain the same, so the items would be written directly, whether or not they end with a newline. With the parameter, writelines would write a newline after each item in the iterable. -- Steve _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@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/AOYVP5XFOJRVWRSMATKQFB5YFOQC7ZTF/ Code of Conduct: http://python.org/psf/codeofconduct/