FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-110383: Added explanation in Doc about array data types range. Based on GNU docs by LombardiDaniel · Pull Request #113708 · python/cpython · GitHub

/ cpython Public
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .rst  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
15 changes: 9 additions & 6 deletions Doc/library/array.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ defined:
+-----------+--------------------+-------------------+-----------------------+-------+
| ``'H'`` | unsigned short | int | 2 | |
+-----------+--------------------+-------------------+-----------------------+-------+
| ``'i'`` | signed int | int | 2 | |
| ``'i'`` | signed int | int | 2 | \(2) |
+-----------+--------------------+-------------------+-----------------------+-------+
| ``'I'`` | unsigned int | int | 2 | |
| ``'I'`` | unsigned int | int | 2 | \(2) |
+-----------+--------------------+-------------------+-----------------------+-------+
| ``'l'`` | signed long | int | 4 | |
| ``'l'`` | signed long | int | 4 | \(2) |
+-----------+--------------------+-------------------+-----------------------+-------+
| ``'L'`` | unsigned long | int | 4 | |
| ``'L'`` | unsigned long | int | 4 | \(2) |
+-----------+--------------------+-------------------+-----------------------+-------+
| ``'q'`` | signed long long | int | 8 | |
| ``'q'`` | signed long long | int | 8 | \(2) |
+-----------+--------------------+-------------------+-----------------------+-------+
| ``'Q'`` | unsigned long long | int | 8 | |
| ``'Q'`` | unsigned long long | int | 8 | \(2) |
+-----------+--------------------+-------------------+-----------------------+-------+
| ``'f'`` | float | float | 4 | |
+-----------+--------------------+-------------------+-----------------------+-------+
Expand All @@ -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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.



The actual representation of values is determined by the machine architecture
(strictly speaking, by the C implementation). The actual size can be accessed
Expand Down

Back | FazBrowse Home | New Git URL