New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define binary data
representation in Python
#60928
Comments
http://docs.python.org/3/library/binascii
tag:easy |
Why? The binascii module consistently uses "data" to refer to binary data. For example: |
In Python 2 there was no 'binary data' type - everything was a string. Now we have string, str, bytearray, array, list of ints. If hexlify is not accepting anything except bytes, it is better be explicit. When porting code from Python 2 the argument was passed as a string with escapes inside, so it took some time to figure out why it didn't work in Py3k (actually it took a lot of time, because the research path turned wrong way at this point). |
But it is very explicit in the link you provided: both a note at the top, and the words "binary data" in the description of every function. |
I agree: the docs is good and don't needed to be modified. |
Fact no.1: When people use docs as a reference, they don't read top notes. Face no.2: I understand that you like the wording in description, but can't understand why don't want to fix this stuff above. |
|
However hexlify is accepting something except bytes. It is accepting any object which supports buffer protocol. |
We do not use data type names as formal parameter names. You will realize this is sensible if you consider that in most cases in Python the formal parameter name is something gets used in more than just the documentation, and that using a type name would shadow the type name, which is something we prefer to avoid. |
The fact that array.array, bytearray and memoryview are also accepted is a surprise for me. It will help if Python docs contained a definition of what can be considered 'binary data' and link this term from hexlify description to this definition. |
data
argument names to bytes
binary data
representation in Python
Isn't such a definition already present in the top-level paragraphs? |
I believe this is part of the goal of bpo-16518, where "bytes-like object" is being proposed as one of the terms for addition to the glossary. |
I concur with Amaury and Andrew. The docs are fine as-is. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: