isn't there a way to implement tail in python with the same class of
performance?

how's tail implemented?

 Xah
 [EMAIL PROTECTED]
∑ http://xahlee.org/

Fredrik Lundh wrote:
> Fredrik Lundh wrote:
>
> > zcat|tail is a LOT faster.
>
> and here's the "right way" to use that:
>
>     from subprocess import Popen, PIPE
>     p1 = Popen(["zcat", filename], stdout=PIPE)
>     p2 = Popen(["tail", "-1"], stdin=p1.stdout, stdout=PIPE)
>     last_line = p2.communicate()[0]
>
> (on my small sample, this is roughly 15 times faster than the empty for loop)
> 
> </F>

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to