in reply to Re: Problem with inline replace
in thread Problem with inline replace

This is great thanks. When you say the p.s. version is faster can you elaborate ?

Replies are listed 'Best First'.
Re^3: Problem with inline replace
by jethro (Monsignor) on Aug 13, 2010 at 15:48 UTC

    It might be faster because the join function is only called on the one line where you want to change something. So join is called once for the file instead of once for each line in the file

    But you might not notice anything of the speedup because your CPU is usually waiting for your hard disc when writing a file. So it does the join while waiting anyway. But at least the CPU will be cooler with the PS version then

    Note, the differences I am talking about are minimal. If you don't have to write files in the gigabytes, there won't be any noticable changes, your script would be just a bit closer to perfection ;-)