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.

classification
Title: Use io.DEFAULT_BUFFER_SIZE for filecmp BUFSIZE variable
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.10
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, greatbahram, methane
Priority: normal Keywords:

Created on 2020-01-02 10:55 by greatbahram, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 17736 closed greatbahram, 2020-01-02 10:55
Messages (5)
msg359188 - (view) Author: Bahram Aghaei (greatbahram) * Date: 2020-01-02 10:55
Hello there,

I was reading the `filecmp` module and I noticed that it defined the BUFSIZE manually, I think it's better to stick to the io.DEFAULT_BUFFER_SIZE variable for both consistency and easy to maintain in the future.


Cheers,
msg370277 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2020-05-29 02:48
Is there some reason a priori that these constants should be defined to be the same rather than being the same coincidentally?
msg370539 - (view) Author: Bahram Aghaei (greatbahram) * Date: 2020-06-01 07:29
Well, I think because the io module provides Python’s main facilities for dealing with various types of I/O, so using io.DEFAULT_BUFFER_SIZE is a kind of standard buffer size. I don't see any scientific reason for choosing the 8 * 1024 inside the filecmp module.

My guess is that guy wanted to use something that is fairly small and would be okay in different circumstances (OSs) and the idea of DEFAULT_BUFFER_SIZE is the same thing.

I think, the chances are high that in the future as computers reinforce, we might change the buffer size as well. So using the io.DEFAULT_BUFFER_SIZE will guarantee that we only change io.DEFAULT_BUFFER_SIZE and every module would be okay automatically?
msg371612 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2020-06-16 01:07
I don't think there's a strong reason these values need to be same. Note, even today, they likely won't be the same since io.DEFAULT_BUFFER_SIZE is only a fallback buffer size used if st_blksize is not set.
msg379642 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-10-26 06:11
I concur with Benjamin.

Although two variables are similar, they are used in the different layer.
History
Date User Action Args
2022-04-11 14:59:24adminsetgithub: 83370
2020-10-26 06:11:31methanesetstatus: open -> closed

nosy: + methane
messages: + msg379642

resolution: rejected
stage: resolved
2020-07-06 07:56:12terry.reedysetversions: + Python 3.10, - Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8
2020-06-16 01:07:07benjamin.petersonsetmessages: + msg371612
2020-06-01 07:29:53greatbahramsetmessages: + msg370539
2020-05-29 02:48:45benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg370277
2020-01-02 10:55:28greatbahramcreate