In <[EMAIL PROTECTED]>, Gregory
Petrosyan wrote:
> Thanks for your reply. I understand this fact, but I wonder why
> writelines() works slowly -- I think C code can be optimised to work
> faster than Python one. Is it correct that writelines(...) is just a
> shorthand for
>
> for ch in ...:
>
Thanks for your reply. I understand this fact, but I wonder why
writelines() works slowly -- I think C code can be optimised to work
faster than Python one. Is it correct that writelines(...) is just a
shorthand for
for ch in ...:
file.write(ch)
?
--
http://mail.python.org/mailman/listinfo/
Gregory Petrosyan wrote:
> My question is: why write(''.join(...)) works slowly than
> writelines(...)? Here's the code:
the first copies all the substring to a single string large enough to
hold all the data, before handing it over to the file object, while the
second just writes the substring