Title: Use binary prefixes
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.3, Python 3.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: brett.cannon, docs@python, ezio.melotti, python-dev, serhiy.storchaka, terry.reedy
Priority: normal Keywords: easy, patch

Created on 2013-02-12 14:54 by serhiy.storchaka, last changed 2013-02-16 15:34 by serhiy.storchaka. This issue is now closed.

File name Uploaded Description Edit
binary_prefixes.patch serhiy.storchaka, 2013-02-12 14:54 review
binary_prefixes_2.patch serhiy.storchaka, 2013-02-12 20:07 review
Messages (13)
msg181961 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-02-12 14:54
Starting around 1998, a number of standards and trade organizations approved standards and recommendations for a new set of binary prefixes that would refer unambiguously to powers of 1024. According to these, the SI prefixes would only be used in the decimal sense, even when referring to data storage capacities: kilobyte and megabyte would denote one thousand bytes and one million bytes respectively (consistent with SI), while new terms such as kibibyte, mebibyte and gibibyte, abbreviated KiB, MiB, and GiB, would denote 1024 bytes, 1048576 bytes, and 1073741824 bytes respectively.[1]

The proposed patch replaces old terms such as kB or KBytes by new terms such as KiB.

msg181964 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-02-12 16:13
Patch looks good except for the consistent lack of space between number and unit, e.g. "5MiB" instead of "5 MiB". Is there a reason for this?
msg181966 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-02-12 16:37
Yes, there is a little reason. It looks ugly if a line broken between number and unit (this is possible if we use space). A non-breakable space is better, but it seems that there is no easy way to specify it in ReST. I will be glad to be wrong.
msg181968 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-02-12 17:04
It might be ugly but it's also incorrect formatting to leave the space out. =) And I think it makes it harder to actually read the number.

If you really want to avoid the breaking you can use the tip at or the Unicode \xa0 literal.
msg181974 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-02-12 20:07
Yes I have seen these tips and they look complicated enough. Here is an updated patch with spaces between numbers and units.
msg181975 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-02-12 21:13
msg182019 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-02-13 10:58
For what versions can I apply this patch?
msg182042 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-02-13 15:47
IMO I say just do 3.4 since it isn't really a bug fix but a cleanup, but I wouldn't object if it was backported.
msg182049 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-02-13 17:07
Then I'll apply this to 3.3 too. This will facilitate support of both versions.
msg182176 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-02-15 21:20

I left some comments on Rietveld.
The SI standard says that there should be a space between the value and the unit, and I agree that while a no-break space would be better, a regular space is still better than no space at all.
Applying this on 3.3 and default is fine too.
msg182186 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-02-15 22:31
I agree that we should contribute to ending the confusion. Searching KiB, MiB, GiB (with Google) gives a Wikipedia article as first or second hit, so the meanings of the abbreviations and terms are easily discoverable.
msg182228 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-02-16 15:31
New changeset c1f846a99c85 by Serhiy Storchaka in branch '3.3':
Issue #17193: Use binary prefixes (KiB, MiB, GiB) for memory units.

New changeset 73a16d3c066a by Serhiy Storchaka in branch 'default':
Issue #17193: Use binary prefixes (KiB, MiB, GiB) for memory units.
msg182229 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-02-16 15:34
Thank you, Ezio, for your comments.
Date User Action Args
2013-02-16 15:34:01serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg182229

stage: commit review -> resolved
2013-02-16 15:31:36python-devsetnosy: + python-dev
messages: + msg182228
2013-02-15 22:31:50terry.reedysetnosy: + terry.reedy
messages: + msg182186
2013-02-15 21:20:58ezio.melottisetnosy: + ezio.melotti
messages: + msg182176
2013-02-13 17:07:26serhiy.storchakasetassignee: docs@python -> serhiy.storchaka
messages: + msg182049
versions: + Python 3.3, Python 3.4
2013-02-13 15:47:33brett.cannonsetmessages: + msg182042
2013-02-13 10:58:22serhiy.storchakasetmessages: + msg182019
2013-02-12 21:13:51brett.cannonsetmessages: + msg181975
stage: patch review -> commit review
2013-02-12 20:07:31serhiy.storchakasetfiles: + binary_prefixes_2.patch

messages: + msg181974
2013-02-12 17:04:49brett.cannonsetmessages: + msg181968
2013-02-12 16:37:42serhiy.storchakasetmessages: + msg181966
2013-02-12 16:13:38brett.cannonsetnosy: + brett.cannon
messages: + msg181964
2013-02-12 14:54:56serhiy.storchakacreate