I\'ve got two pieces of code that are both meant to do the same thing -- sit in a loop until a file is done being written to. They are both mainly used for files coming in
In CPython 2.6 and 2.7, os.path.getsize()
is implemented as follows:
def getsize(filename):
"""Return the size of a file, reported by os.stat()."""
return os.stat(filename).st_size
From this, it seems pretty clear that there is no reason to expect the two approaches to behave differently (except perhaps due to the different structures of the loops in your code).