Imitating "tail -f"

Wolodja Wentland wentland at cl.uni-heidelberg.de
Sun Nov 22 04:11:44 EST 2009


On Sun, Nov 22, 2009 at 03:43 +0100, Ivan Voras wrote:
> I'm trying to simply imitate what "tail -f" does, i.e. read a file, wait
> until it's appended to and process the new data, but apparently I'm
> missing something.
[..]
> Any advice?

Have a look at [1], which mimics "tail -f" perfectly. It comes from a
talk by David Beazley on generators which you can find at [2] and
[3].

Enjoy!

[1] http://www.dabeaz.com/generators/follow.py
[2] http://www.dabeaz.com/generators-uk/
[3] http://www.dabeaz.com/coroutines/

-- 
  .''`.     Wolodja Wentland    <wentland at cl.uni-heidelberg.de> 
 : :'  :    
 `. `'`     4096R/CAF14EFC 
   `-       081C B7CD FF04 2BA9 94EA  36B2 8B7F 7D30 CAF1 4EFC
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20091122/f8c727d3/attachment.sig>


More information about the Python-list mailing list