-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
gh-110383: Added explanation in Doc about array data types range. Based on GNU docs #113708
Conversation
array -- data type sizes based on GNU documentation Signed-off-by: Daniel Lombardi <lombardi.daniel.o@gmail.com>
Can check altered docs at: library/array.html#module-array |
Signed-off-by: Daniel Lombardi <lombardi.daniel.o@gmail.com>
Isn't it outdated? I am not sure that on most machines that run Python |
Yes. See also my comment above. The proposed text is not correct in several ways:
Other than that I don't understand why adding these notes is helpful for users, these notes don't add anything that I (as a user) can use. |
Eh. I do no see any other your comment. I agree that this change is perhaps not very useful. |
Doc/library/array.rst
Outdated
(2) | ||
Int data types (signed or unsigned) can be 16 or 32 bits depending on the platform. The | ||
same way that long data types can be 32 or 64 bits depending on the platform. On most | ||
machines that run GNU C Library, an int is a 32-bit quantity. On most machines, long | ||
int is also 32-bit, the same size as int. And lastly, on most machines, long long int | ||
are 64-bit quantities. View more at: https://www.gnu.org/software/libc/manual/html_node/Range-of-Type.html | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO "on most machines ..." doesn't really add anything.
In practice most general purpose machines are one of:
- 32-bit CPUs: int, long are 32 bit, long long is 64 bit
- 64-bit CPUs running Windows: int, long are 32-bit, long long is 64-bit
- 64-bit CPUs running Unix-y systems (including Linux and macOS): int is 32-bit, long and long long are 64-bit
There are exceptions to this, but AFAIK most of those are special CPUs like DSPs or are from before the existence of C. Neither of which are useful to mention here.
You should now, apparently it is important to actually post comments 🤦. That also explains why nobody reacted to my comment...
|
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
@@ -60,6 +60,9 @@ Notes: | |||
.. deprecated-removed:: 3.3 3.16 | |||
Please migrate to ``'w'`` typecode. | |||
|
|||
(2) | |||
As of 2024, 'h', 'i', 'l', and 'q' are usually 2, 4, 4 on Windows else 8, and 8 bytes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This note talks about h
, so if it's kept, the \(2)
should be added to the h
& H
lines in the table.
But, maybe this PR should be closed without merging. If you're wrinting cross-platform code you shouldn't rely on “common” values; if not you can use itemsize
to find values that are actually right for your platform.
I have no more opinions on this. Do whatever. |
array -- data type sizes based on GNU documentation: https://www.gnu.org/software/libc/manual/html_node/Range-of-Type.html
📚 Documentation preview 📚: https://cpython-previews--113708.org.readthedocs.build/