Q: finding distance between 2 time's

martin at hvidberg.net martin at hvidberg.net
Sun May 31 08:14:44 EDT 2009


On May 30, 11:37 pm, jkv <j... at unixcluster.dk> wrote:
> mar... at hvidberg.net wrote:
> > Thanks both
>
> > The first answer is quite instuctive, the other one might be the one
> > I'll use in t
>
> I didn't receive the other answer, could you please forward it to me?> So 2x thanks.
>
> You are welcome.
>
> I took another look at your code, and you can compress it all to a if
> "oneliner":
> (and thanks to Steven for the <= reminder)
>
>         if os.path.isfile(x):
>             nSize = os.path.getsize(x)
>             #if oneliner
>             if time.mktime(time.localtime()) -
> time.mktime(time.localtime(os.path.getmtime(x))) <= 3600:
>               print ('HT fil -> %s %d @ %s') % (x, nSize, time.asctime)

I encurrage both Clarity and Brevity, but usually in that order.
In other words, I don't mind to split a statement in two (or three)
sub-sentenses, if it increases Clarity. As long as it dosn't so large
that I loose the overview, and as long as it dosn't affect runtime
performance.



More information about the Python-list mailing list