Message372412
The proposed change adds a Boolean flag to os.path.getsize() so that it returns:
os.stat(filename).st_blocks * 512
(where the 512 is the file system block size on Linux; some work is needed to make this portable to other operating systems).
The Boolean argument here would always be constant in practice -- that is, you'd always call it like this:
virtual_size = os.path.getsize(filename, apparent=True)
allocated_size = os.path.getsize(filename, apparent=False)
and never like this:
x_size = os.path.getsize(filename, apparent=x)
where x varies at runtime.
The "no constant bool arguments" design principle [1] suggests that this should be added as a new function, something like os.path.getallocatedsize().
[1] https://mail.python.org/pipermail/python-ideas/2016-May/040181.html |
|
Date |
User |
Action |
Args |
2020-06-26 07:03:47 | gdr@garethrees.org | set | recipients:
+ gdr@garethrees.org, stephenfin |
2020-06-26 07:03:47 | gdr@garethrees.org | set | messageid: <1593155027.63.0.107946214814.issue41092@roundup.psfhosted.org> |
2020-06-26 07:03:47 | gdr@garethrees.org | link | issue41092 messages |
2020-06-26 07:03:47 | gdr@garethrees.org | create | |
|