Meta tags:
description= A quick and pointless look at implementing tail in Python. Something of a koan.;
Headings (most frequently used words):
tailing, in, python, my, implementation,
Text of the page (most frequently used words):
#python (9), you (9), fin (9), and (8), line (8), for (7), lines (7), than (6), the (6), tail (6), are (5), file (5), better (5), with (4), engineering (4), rss (3), newsletter (3), from (3), management (3), get (3), where (3), main (3), args (3), def (3), then (3), your (3), about (2), tags (2), will (2), larson (2), how (2), leadership (2), heavy (2), popular (2), crafting (2), here (2), yours (2), readlines_then_tail (2), optionparser (2), yield (2), else (2), sleep_interval (2), time (2), not (2), readline (2), true (2), while (2), new (2), through (2), import (2), solution (2), implementation (2), working (2), supports (2), existing (2), following (2), have (2), know (2), just (2), tailing (2), irrational (2), exuberance (2), 2026, stripping, illegal, characters, xml, using, threadpools, remotely, admin, servers, via, twitter, photo, album, pil, markdown, extension, embedding, graphviz, related, revised, rules, make, assumptions, generated, suppressed, demand, middle, roles, also, trap, roadmap, decisions, rather, dates, recent, create, software, quality, eng, org, seniority, mix, model, moving, orchestration, role, good, fad, building, internal, agents, like, updates, weekly, emails, follow, feed, subscribe, wrote, strategy, executive, primer, staff, engineer, elegant, puzzle, books, looking, reach, out, ways, help, folks, now, name, strip, print, open, must, specify, watch, error, len, parse_args, options, usage, seek, sleep, tell, listen, added, iterate, further, optparse, consideration, well, coding, style, mine, performance, fast, slow, conciseness, short, long, simplicity, simple, complex, correctness, judging, criteria, iterating, all, they, appear, newly, appended, showing, without, too, staring, blank, wall, confusion, this, fine, sunday, perhaps, can, write, own, which, meets, these, requirements, there, other, days, when, lost, ability, function, any, meaningful, way, end, putting, disproportionate, amount, mental, energy, into, version, don, writing, complicated, systems, fantastic, feeling, ideas, that, sit, down, pen, paper, think, bit, might, even, talk, coworker, instead, imagining, perfect, right, off, bat, implementing, code_that_wont_get_used_for_various_reasons, misguided_solution, r9999, vast, published, may, 2010,
Text of the page (random words):
tailing in python irrational exuberance irrational exuberance popular tags newsletter rss about tailing in python published on may 16 2010 python 65 writing complicated systems is a fantastic feeling you know ideas so vast that you have to sit down with pen and paper just to think for a bit you might even talk with a coworker instead of just imagining your solution is perfect right off the bat and implementing code_that_wont_get_used_for_various_reasons misguided_solution py r9999 then there are other days when you have lost the ability to function in any meaningful way and you end up putting a disproportionate amount of mental energy into crafting a python version of i don t know tail if you too are staring at a blank wall in confusion on this fine sunday perhaps you can write your own python implementation of tail which meets these requirements supports following newly appended lines to a file without showing the existing lines of the file supports iterating through all the existing lines and then following new lines as they appear judging criteria are correctness working is better than not working simplicity simple is better than complex conciseness short is better than long performance fast is better than slow style mine is better than yours well get coding my implementation for your consideration here is my solution import time from optparse import optionparser sleep_interval 1 0 def readlines_then_tail fin iterate through lines and then tail for further lines while true line fin readline if line yield line else tail fin def tail fin listen for new lines added to file while true where fin tell line fin readline if not line time sleep sleep_interval fin seek where else yield line def main p optionparser usage tail py file options args p parse_args if len args 1 p error must specify a file to watch with open args 0 r as fin for line in readlines_then_tail fin print line strip if name main main now where s yours hi folks i m will larson if you re looking to reach out to me here are ways i help books i wrote an elegant puzzle staff engineer the engineering executive s primer and crafting engineering strategy newsletter if you d like to get get updates subscribe for weekly emails or follow my rss feed popular building internal agents good engineering management is a fad moving from an orchestration heavy to leadership heavy management role eng org seniority mix model how to create software quality recent roadmap decisions rather than dates middle management roles are also a trap generated and suppressed demand make no assumptions revised rules of engineering leadership related a python markdown extension for embedding graphviz a photo album with python and pil how to remotely admin servers via twitter using threadpools in python stripping illegal characters from xml in python will larson 2026 tags newsletter rss about
|