reading the last line of a file

Michael Sparks ms at cerenity.org
Thu Sep 8 18:50:05 EDT 2005


Xah Lee wrote:
> isn't there a way to implement tail in python with the same class of
> performance?
>
> how's tail implemented?:

Those crazy open source developers have an implementation here:
http://cvs.sourceforge.net/viewcvs.py/mkcdrec/mkcdrec/busybox-0.60.5/Attic/tail.c?rev=1.1&view=markup

It's not documented. It's pretty short though, I'm sure you won't have any
problems <strike>ripping it to pieces</strike> understanding it.

If it is a problem, a more documented version here (however I'm sorry, this
also by those open source/free software people you love to attack):

http://www.koders.com/c/fid8DEE98A42C35A1346FA89C328CC3BF94E25CF377.aspx

If you want something not by open source crazies (as you like to refer to
us), you may prefer this link:
   http://minnie.tuhs.org/UnixTree/V7/usr/src/cmd/tail.c.html

However that's even less documented (despite being not open source, just
"visible"), and more obfuscated.

As a compromise, you could always look at plan 9's implementation here:
   * http://swtch.com/usr/local/plan9/src/cmd/tail.c

If you're after alternatives, you could always try here: (where all these
links came from)
    http://www.google.com/search?q=tail.c

Fairly informative set of links provided by that highly non-obvious
search....

Hope that helps,

Best Regards,


Michael.




More information about the Python-list mailing list