Terry J. Reedy added the comment:
I find this to be a confusing issue.
1. The arg for .join is any iterable of strings, not just a list. (I think
Daniel got that.) Since codecs.py still has "self.write(''.join(list))":
a) calling the arg 'list' is doubly wrong.
b) there is no iterable feature to add, at least not to the base class.
2. The codecs.writelines entry says "Writes the concatenated list of strings to
the stream (possibly by reusing the write() method)." For the base class, that
is overly restrictive, but I gather that Marc-Andre does not want to require
that all subclasses be as relaxed. I presume there must be a reason. That means
that the feature request of doing so is rejected by him. In that respect, this
should be closed unless other developers strongly disagree.
3. The iobase.writelines entry says "Write a list of lines to the stream." For
StreamIO, iter(somelist) works just as well. If that applies to .writelines in
general, the doc should say 'iterable of lines'. (Antoine, Benjamin?)
If io.writelines does the same (concatenate all together), it should say so,
but one comment suggests it does not
4. If an iterable produces millions of lines, it does not matter if it is a
list, generator, or any other iterable. So the title does not point to the real
problem, if there is one.
----------
nosy: +benjamin.peterson, pitrou, terry.reedy
stage: -> patch review
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue5445>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com