[Python-Dev] Function in os module for available disk space, why not?

Gordon McMillan gmcm@hypernet.com
Mon, 19 Mar 2001 09:27:04 -0500


Dinu Gherman wrote:

[disk free space...]
> I'm just trying to make the point that from a user perspective it
> would be more complete to have such a function in the os module
> (where it belongs), that would also work on Macs e.g., as well as
> more conveniant, because even when that existed in modules like
> win32api (where it does) and in one of the (many) mac* ones
> (which I don't know yet if it does) it would save you the
> if-statement on sys.platform.

Considering that:
 - it's not uncommon to map things into the filesystem's 
namespace for which "free space" is meaningless
 - for network mapped storage space it's quite likely you can't 
get a meaningful number
 - for compressed file systems the number will be inaccurate
 - even if you get an accurate answer, the space may not be 
there when you go to use it (so need try... except anyway)

I find it perfectly sensible that Python does not dignify this 
mess with an official function.

- Gordon