rename(2) has an advantage that it can (maybe dosent) gaurentee that if
the implicit unlink(2) happens, then the renameing happens.
rename(2) will only fail when you have a permmissions problem or the
like. This will generally happen because the current .pyc is
unremovable and out of date, therefore you should simply remove
module.pid and go on, ignoring the old .pyc. Assuming that it is
likely the same as the file you just made presumes that the general
case involves two people rushing to make identical copies, which it is
not.
I dont follow the reference to a loop at all. It simply isnt likely
that you are going to have two competing processes writing this file,
much less three or more. And 'so what' if they are. the last one will
'win', and none will be the worse off for it.
-- John Redford (AKA GArrow) | 3,600 hours of tape. jredford@lehman.com | 5 cans of Scotchguard.