This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gdr@garethrees.org
Recipients gdr@garethrees.org, stephenfin
Date 2020-06-26.07:03:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1593155027.63.0.107946214814.issue41092@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2020-06-26 07:03:47gdr@garethrees.orgsetrecipients: + gdr@garethrees.org, stephenfin
2020-06-26 07:03:47gdr@garethrees.orgsetmessageid: <1593155027.63.0.107946214814.issue41092@roundup.psfhosted.org>
2020-06-26 07:03:47gdr@garethrees.orglinkissue41092 messages
2020-06-26 07:03:47gdr@garethrees.orgcreate