[PATCH] Do not read file to memory on commit

Harri Salokorpi hsalokor at ee.oulu.fi
Sat Apr 16 23:42:48 BST 2005


Hello,

Fredrik Lundh wrote:
> why os.lstat instead of os.stat (or os.path.getsize)?

No reason, I'm not familiar enough with stat so I took example from 
existing code (consistency and so on). I was under impression that 
os.path.getsize uses stat anyway?

> also note that if you have an opened file (like in this case), doing
> 
>    try:
>        st = os.fstat(file.fileno())
>    except AttributeError:
>        st = os.stat(filename)
>    size = st[ST_SIZE]
> 
> might be faster (but someone should benchmark this)

Ok, thanks for the tip!

-Harri




More information about the bazaar mailing list