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

Dinu Gherman gherman@darwin.in-berlin.de
Mon, 19 Mar 2001 14:32:17 +0100


Fredrik Lundh wrote:
> 
> fwiw, Python already supports this for real Unix platforms:
> 
> >>> os.statvfs("/")
> (8192, 512, 524288, 365788, 348336, 600556, 598516, 598516, 0, 255)
> 
> here, the root disk holds 524288x512 bytes, with 348336x512
> bytes free for the current user, and 365788x512 bytes available
> for root.
> 
> (the statvfs module contains indices for accessing this "struct")
> 
> Implementing a small subset of statvfs for Windows wouldn't
> be that hard (possibly returning None for fields that don't make
> sense, or are too hard to figure out).
> 
> (and with win32all, I'm sure it can be done without any C code).
> 
> Cheers /F

Everything correct! 

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.

It sounds silly to me if people now pushed into learning Py-
thon as a first programming language had to use such state-
ments to get along, but were given the 'gift' of 1/2 = 0.5
which we seem to spend an increasing amount of brain cycles
on...

Regards,

Dinu

-- 
Dinu C. Gherman
ReportLab Consultant - http://www.reportlab.com
................................................................
"The only possible values [for quality] are 'excellent' and 'in-
sanely excellent', depending on whether lives are at stake or 
not. Otherwise you don't enjoy your work, you don't work well, 
and the project goes down the drain." 
                    (Kent Beck, "Extreme Programming Explained")